Changeset 2568441
- Timestamp:
- 07/20/2021 05:48:45 PM (5 years ago)
- Location:
- service
- Files:
-
- 80 added
- 7 edited
-
tags/1.0.0 (added)
-
tags/1.0.0/images (added)
-
tags/1.0.0/images/sort_asc.png (added)
-
tags/1.0.0/images/sort_both.png (added)
-
tags/1.0.0/images/sort_desc.png (added)
-
tags/1.0.0/includes (added)
-
tags/1.0.0/includes/api.php (added)
-
tags/1.0.0/includes/function.php (added)
-
tags/1.0.0/js (added)
-
tags/1.0.0/js/dataTables.buttons.min.js (added)
-
tags/1.0.0/js/dataTables.select.min.js (added)
-
tags/1.0.0/js/jquery.dataTables.min.css (added)
-
tags/1.0.0/js/jquery.dataTables.min.js (added)
-
tags/1.0.0/js/jquery.mask.min.js (added)
-
tags/1.0.0/lang (added)
-
tags/1.0.0/lang/en_US.json (added)
-
tags/1.0.0/lang/ru_RU.json (added)
-
tags/1.0.0/lang/service-ru_RU.mo (added)
-
tags/1.0.0/pages (added)
-
tags/1.0.0/pages/orders.php (added)
-
tags/1.0.0/readme.txt (added)
-
tags/1.0.0/service.php (added)
-
tags/1.0.0/uninstall.php (added)
-
tags/1.0.1 (added)
-
tags/1.0.1/images (added)
-
tags/1.0.1/images/sort_asc.png (added)
-
tags/1.0.1/images/sort_both.png (added)
-
tags/1.0.1/images/sort_desc.png (added)
-
tags/1.0.1/includes (added)
-
tags/1.0.1/includes/api.php (added)
-
tags/1.0.1/includes/function.php (added)
-
tags/1.0.1/js (added)
-
tags/1.0.1/js/dataTables.buttons.min.js (added)
-
tags/1.0.1/js/dataTables.select.min.js (added)
-
tags/1.0.1/js/jquery.dataTables.min.css (added)
-
tags/1.0.1/js/jquery.dataTables.min.js (added)
-
tags/1.0.1/js/jquery.mask.min.js (added)
-
tags/1.0.1/lang (added)
-
tags/1.0.1/lang/en_US.json (added)
-
tags/1.0.1/lang/ru_RU.json (added)
-
tags/1.0.1/lang/service-ru_RU.mo (added)
-
tags/1.0.1/pages (added)
-
tags/1.0.1/pages/orders.php (added)
-
tags/1.0.1/pages/settings.php (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/receipt.txt (added)
-
tags/1.0.1/service.php (added)
-
tags/1.0.1/uninstall.php (added)
-
tags/1.0.1/warranty.txt (added)
-
tags/1.0.2 (added)
-
tags/1.0.2/images (added)
-
tags/1.0.2/images/sort_asc.png (added)
-
tags/1.0.2/images/sort_both.png (added)
-
tags/1.0.2/images/sort_desc.png (added)
-
tags/1.0.2/includes (added)
-
tags/1.0.2/includes/api.php (added)
-
tags/1.0.2/includes/function.php (added)
-
tags/1.0.2/js (added)
-
tags/1.0.2/js/dataTables.buttons.min.js (added)
-
tags/1.0.2/js/dataTables.select.min.js (added)
-
tags/1.0.2/js/google.charts.js (added)
-
tags/1.0.2/js/jquery.dataTables.min.css (added)
-
tags/1.0.2/js/jquery.dataTables.min.js (added)
-
tags/1.0.2/js/jquery.mask.min.js (added)
-
tags/1.0.2/lang (added)
-
tags/1.0.2/lang/en_US.json (added)
-
tags/1.0.2/lang/ru_RU.json (added)
-
tags/1.0.2/lang/service-ru_RU.mo (added)
-
tags/1.0.2/lang/service-ru_RU.po (added)
-
tags/1.0.2/lang/service.pot (added)
-
tags/1.0.2/pages (added)
-
tags/1.0.2/pages/orders.php (added)
-
tags/1.0.2/pages/settings.php (added)
-
tags/1.0.2/pages/statistics.php (added)
-
tags/1.0.2/readme.txt (added)
-
tags/1.0.2/receipt.txt (added)
-
tags/1.0.2/service.php (added)
-
tags/1.0.2/uninstall.php (added)
-
tags/1.0.2/warranty.txt (added)
-
trunk/includes/api.php (modified) (2 diffs)
-
trunk/includes/function.php (modified) (1 diff)
-
trunk/lang/service-ru_RU.mo (modified) (previous)
-
trunk/pages/orders.php (modified) (9 diffs)
-
trunk/pages/statistics.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/service.php (modified) (4 diffs)
-
trunk/uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
service/trunk/includes/api.php
r2565526 r2568441 39 39 add_action('rest_api_init', function (){ 40 40 41 register_rest_route('service', 'statistics', array( 42 'methods' => 'GET', 43 'permission_callback' => function(){ 44 return current_user_can('service_user'); 45 }, 46 'callback' => function($request_data){ 47 48 global $wpdb; 49 foreach ($wpdb->get_results("SELECT sum(cost_total-cost_spare), DATE_FORMAT(`date_issue`, '%Y-%m') as period FROM $wpdb->service_orders WHERE `date_issue` >= DATE_FORMAT(CURRENT_DATE - INTERVAL 10 YEAR, '%Y-%m-01') GROUP BY period", ARRAY_A) as $row) { 50 $month[] = [$row['period'], (int)$row['sum(cost_total-cost_spare)']]; 51 } 52 foreach ($wpdb->get_results("SELECT DATE_FORMAT(date_issue, '%d') as date, sum(cost_total-cost_spare) FROM $wpdb->service_orders WHERE MONTH(`date_issue`) = MONTH(NOW()) AND YEAR(`date_issue`) = YEAR(NOW()) GROUP BY 1 ASC", ARRAY_A) as $row) { 53 $day[] = [$row['date'], (int)$row['sum(cost_total-cost_spare)']]; 54 } 55 $res = $wpdb->get_row("SELECT (SELECT sum(cost_total-cost_spare) FROM $wpdb->service_orders WHERE (MONTH(`date_issue`) = MONTH(NOW()) AND (YEAR(`date_issue`) = YEAR(NOW())) ) ) / (EXTRACT(DAY FROM CURDATE()))", ARRAY_N); 56 wp_send_json( [ 'day' => $day, 'month' => $month, 'forecast' => round($res[0]) ] ); 57 58 } 59 )); 60 41 61 register_rest_route('service', 'orders', array( 42 62 'methods' => 'GET', … … 53 73 global $wpdb; 54 74 $data = $wpdb->get_results( "SELECT id, id_label, date, model, serial, malfunction, client, number, work, cost_spare, cost_total, status, manager_notes FROM `$wpdb->service_orders` $where $order $limit", ARRAY_A ); 55 $resTotalLength = $wpdb->get_var("SELECT COUNT(`id`) FROM `$wpdb->service_orders` ");75 $resTotalLength = $wpdb->get_var("SELECT COUNT(`id`) FROM `$wpdb->service_orders` $where"); 56 76 wp_send_json([ 57 77 "draw" => intval( $parameters['draw'] ) , -
service/trunk/includes/function.php
r2565526 r2568441 67 67 }); 68 68 69 70 69 //settings page 71 70 add_action('wp_ajax_save_settings', function (){ -
service/trunk/pages/orders.php
r2565526 r2568441 88 88 89 89 90 91 92 90 <br> 93 91 <table id="table_repair" class="display" style="width:100%"> 94 <thead>95 <tr>96 <th>97 </th>98 <th>№</th>99 <th><?php _e('Date', 'service');?></th>100 <th><?php _e('Model', 'service');?></th>101 <th><?php _e('Malfunction', 'service');?></th>102 <th><?php _e('Client', 'service');?></th>103 <th><?php _e('Work', 'service');?></th>104 <th><?php _e('Cost spare', 'service');?></th>105 <th><?php _e('Total cost', 'service');?></th>106 <th><?php _e('Status', 'service');?></th>107 <th><?php _e('Notes', 'service');?></th>108 </tr>109 </thead>110 111 92 </table> 112 93 <br> 113 114 94 <button id="delete" class="button" style="display:none;"><?php _e('Delete', 'service');?></button> 115 95 </div> … … 275 255 }, 276 256 277 278 257 createdRow: function(row, data, index){ 279 258 … … 292 271 }, 293 272 294 {data: 'id_label' },295 296 {data: 'date' },297 298 {data: 'model', 273 {data: 'id_label', title: '№'}, 274 275 {data: 'date', title: '<?php _e('Date', 'service');?>'}, 276 277 {data: 'model', title: '<?php _e('Model', 'service');?>', 299 278 render : function (data, type, row) { 300 279 return '<b>' + data + '</b><br><span class="serial">' + row.serial + '</span>' … … 302 281 }, 303 282 304 {data: 'malfunction' },305 306 {data: 'client', 283 {data: 'malfunction', title: '<?php _e('Malfunction', 'service');?>'}, 284 285 {data: 'client', title: '<?php _e('Client', 'service');?>', 307 286 render : function (data, type, row) { 308 287 return '<b>' + data + '</b><br><span class="number">' + row.number + '</span>' … … 310 289 }, 311 290 312 {data: 'work', 291 {data: 'work', title: '<?php _e('Work', 'service');?>', 313 292 render : function (data, type, row) { 314 293 return '<input type="text" class="work" value = "'+data+'" >' … … 316 295 }, 317 296 318 {data: 'cost_spare', 297 {data: 'cost_spare', title: '<?php _e('Cost spare', 'service');?>', 319 298 render : function (data) { 320 299 return '<input type="text" class="cost_spare" value = "'+data+'" size=5>' … … 322 301 }, 323 302 324 {data: 'cost_total', 303 {data: 'cost_total', title: '<?php _e('Total cost', 'service');?>', 325 304 render : function (data) { 326 305 return '<input type="text" class="cost_total" value = "'+data+'" size=5>' … … 328 307 }, 329 308 330 {data: 'status', 309 {data: 'status', title: '<?php _e('Status', 'service');?>', 331 310 render : function (data, type, row) { 332 311 let select = '<select id="'+row.id+'"><option>'+orderStatus[data]+'</option>'; … … 340 319 }, 341 320 342 {data: 'manager_notes', 321 {data: 'manager_notes', title: '<?php _e('Notes', 'service');?>', 343 322 render : function (data, type, row) { 344 323 return '<input type="text" class="manager_notes" value = "'+data+'" >' -
service/trunk/readme.txt
r2565526 r2568441 3 3 Tags: crm, service 4 4 Requires at least: 4.7 5 Tested up to: 5. 7.26 Stable tag: 1.0. 15 Tested up to: 5.8 6 Stable tag: 1.0.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 13 13 14 14 == Changelog == 15 16 = 1.0.2 = 17 *Release Date - 20 Jul 2021* 18 19 * Added statistics function 15 20 16 21 = 1.0.1 = -
service/trunk/service.php
r2565526 r2568441 5 5 * Plugin URI: https://wordpress.org/plugins/service/ 6 6 * Description: The CRM for service center 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * Requires at least: 5.7.2 9 9 * Requires PHP: 7.4 … … 45 45 esc_html__('Orders', 'service'), 46 46 'service_user', 47 ' orders',47 'service-orders', 48 48 function() {include 'pages/orders.php';}); 49 49 remove_submenu_page('service.php','service.php'); … … 63 63 esc_html__('Settings', 'service'), 64 64 esc_html__('Settings', 'service'), 65 ' manage_options',66 'se ttings',65 'service_user', 66 'service-settings', 67 67 function() {include 'pages/settings.php';}); 68 68 add_action( 'load-' . $page, function (){ … … 70 70 } ); 71 71 }); 72 73 add_action('admin_menu', function (){ 74 $page = add_submenu_page('service.php', 75 esc_html__('Statistics', 'service'), 76 esc_html__('Statistics', 'service'), 77 'service_user', 78 'service-statistics', 79 function() {include 'pages/statistics.php';}); 80 add_action( 'load-' . $page, function (){ 81 wp_enqueue_script( 'google_charts', plugins_url('/js/google.charts.js', __FILE__) ); 82 } ); 83 }); 84 85 86 72 87 73 88 register_activation_hook(__FILE__, function () { -
service/trunk/uninstall.php
r2565526 r2568441 1 1 <?php 2 2 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) 4 die(); 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) die(); 5 4 6 5 global $wpdb; … … 9 8 delete_option('service_print_receipt'); 10 9 delete_option('service_print_warranty'); 10 delete_option('service_sms_api_key'); 11 11 delete_option( 'service_imei_api_key'); 12 delete_option( 'service_imei_api_key_status');
Note: See TracChangeset
for help on using the changeset viewer.