PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / layouts / statistics / widgets / appointments / overall.php
vikappointments / admin / layouts / statistics / widgets / appointments Last commit date
coupons 5 days ago customers 5 days ago payments 5 days ago revenue 5 days ago status 5 days ago times 5 days ago index.html 5 days ago overall.php 5 days ago rog.php 5 days ago
overall.php
112 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Layout variables
16 * -----------------
17 * @var VAPStatisticsWidget $widget The instance of the widget to be displayed.
18 */
19 extract($displayData);
20
21 ?>
22
23 <style>
24
25 .canvas-align-center .overall {
26 text-align: center;
27 }
28 .canvas-align-center .overall .overall-earning {
29 font-size: 40px;
30 margin-bottom: 20px;
31 color: #476799;
32 font-weight: bold;
33 }
34 .canvas-align-center .overall .overall-count {
35 font-size: 26px;
36 color: #002243;
37 font-weight: 500;
38 }
39
40 </style>
41
42 <div class="canvas-align-center">
43
44 <div class="overall">
45 <div class="overall-earning"></div>
46 <div class="overall-count"></div>
47 </div>
48
49 </div>
50
51 <div class="widget-floating-box">
52
53 <span class="badge badge-success pull-left summary" style="margin-right: 4px;"></span>
54 <span class="badge badge-warning pull-left datefrom" style="margin-right: 4px;"></span>
55 <span class="badge badge-warning pull-left dateto"></span>
56
57 </div>
58
59 <script>
60
61 (function($) {
62 'use strict';
63
64 /**
65 * Register callback to be executed after
66 * completing the update request.
67 *
68 * @param mixed widget The widget selector.
69 * @param mixed data The AJAX response.
70 * @param object config The widget configuration.
71 *
72 * @return void
73 */
74 WIDGET_CALLBACKS[<?php echo $widget->getID(); ?>] = (widget, data, config) => {
75 // show overall information
76 $(widget).find('.canvas-align-center').show();
77
78 if (data.hasOwnProperty('formattedTotal')) {
79 // the user owns financial rights, display both total and count
80 $(widget).find('.overall-earning').text(data.formattedTotal);
81 $(widget).find('.overall-count').text(data.formattedCount);
82 } else {
83 // the user doesn't own financial rights, display count only
84 $(widget).find('.overall-earning').text(data.formattedCount);
85 }
86
87 // update quick summary
88 $(widget).find('.badge.summary').text(data.summary ? data.summary : '');
89
90 // display dates only in case the summary is empty
91 data.from = !data.summary && data.from ? data.from : '';
92 data.to = !data.summary && data.to ? data.to : '';
93
94 if (!data.from && data.to) {
95 // display LT meaning the date is a "ceil"
96 data.to = '< ' + data.to;
97 }
98
99 if (data.from && !data.to) {
100 // display GT meaning the date is a "floor"
101 data.from = '> ' + data.from;
102 }
103
104 // update from date
105 $(widget).find('.badge.datefrom').text(data.from);
106 // update to date (hide in case it is equals to the from date)
107 $(widget).find('.badge.dateto').text(data.to != data.from ? data.to : '');
108 }
109 })(jQuery);
110
111 </script>
112