/
index.phtml
108 lines (103 loc) · 4.39 KB
/
index.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?>
<script>
require([
'Magento_Ui/js/modal/alert',
'prototype'
], function(alert){
window.changeDiagramsPeriod = function(periodObj) {
periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
<?php foreach ($block->getChildBlock('diagrams')->getTabsIds() as $tabId): ?>
ajaxBlockParam = 'block/tab_<?php /* @escapeNotVerified */ echo $tabId ?>/';
ajaxBlockUrl = '<?php echo $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => '']) ?>' + ajaxBlockParam + periodParam;
new Ajax.Request(ajaxBlockUrl, {
parameters: {isAjax: 'true', form_key: FORM_KEY},
onSuccess: function(transport) {
tabContentElementId = '<?php /* @escapeNotVerified */ echo $block->getChildBlock('diagrams')->getId() ?>_<?php /* @escapeNotVerified */ echo $tabId ?>_content';
try {
if (transport.responseText.isJSON()) {
var response = transport.responseText.evalJSON()
if (response.error) {
alert({
content: response.message
});
}
if(response.ajaxExpired && response.ajaxRedirect) {
setLocation(response.ajaxRedirect);
}
} else {
$(tabContentElementId).update(transport.responseText);
}
}
catch (e) {
$(tabContentElementId).update(transport.responseText);
}
}
});
<?php endforeach; ?>
ajaxBlockUrl = '<?php echo $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => '']) ?>' + periodParam;
new Ajax.Request(ajaxBlockUrl, {
parameters: {isAjax: 'true', form_key: FORM_KEY},
onSuccess: function(transport) {
tabContentElementId = 'dashboard_diagram_totals';
try {
if (transport.responseText.isJSON()) {
var response = transport.responseText.evalJSON();
if (response.error) {
alert({
content: response.message
});
}
if(response.ajaxExpired && response.ajaxRedirect) {
setLocation(response.ajaxRedirect);
}
} else {
$(tabContentElementId).replace(transport.responseText);
}
}
catch (e) {
$(tabContentElementId).replace(transport.responseText);
}
}
});
}
});
</script>
<?php endif; ?>
<div class="dashboard-container row">
<div class="dashboard-main col-m-8 col-m-push-4">
<div class="dashboard-diagram-container">
<?php echo $block->getChildHtml('diagrams') ?>
<?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?>
<div id="diagram_tab_content" class="dashboard-diagram-tab-content"></div>
<?php endif; ?>
</div>
<?php echo $block->getChildHtml('totals') ?>
<div class="dashboard-store-stats">
<?php echo $block->getChildHtml('grids') ?>
<div id="grid_tab_content" class="dashboard-store-stats-content"></div>
<?php echo $block->getChildHtml('refresh_statistics') ?>
</div>
</div>
<div class="dashboard-secondary col-m-4 col-m-pull-8">
<?php echo $block->getChildHtml('sales') ?>
<div class="dashboard-item">
<div class="dashboard-item-title"><?php /* @escapeNotVerified */ echo __('Last Orders') ?></div>
<?php echo $block->getChildHtml('lastOrders'); ?>
</div>
<div class="dashboard-item">
<div class="dashboard-item-title"><?php /* @escapeNotVerified */ echo __('Last Search Terms') ?></div>
<?php echo $block->getChildHtml('lastSearches'); ?>
</div>
<div class="dashboard-item">
<div class="dashboard-item-title"><?php /* @escapeNotVerified */ echo __('Top Search Terms') ?></div>
<?php echo $block->getChildHtml('topSearches'); ?>
</div>
</div>
</div>