-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodify_single_request.php
More file actions
207 lines (185 loc) · 9.8 KB
/
Copy pathmodify_single_request.php
File metadata and controls
207 lines (185 loc) · 9.8 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/*
Copyright (C) 2007 - 2021, Christoph Marti
Copyleft 2021- Christian M. Stefan, Florian Meerwinck
LICENCE TERMS:
This module is free software. You can redistribute it and/or modify it
under the terms of the GNU General Public License - version 2 or later,
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
DISCLAIMER:
This module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
require('../../config.php');
// Include WB admin wrapper script
require WB_PATH.'/modules/admin.php';
require __DIR__.'/functions.php';
$cfg = bxt_getGlobalCfg();
$sCurrency = $cfg['shop_currency'];
I::insertCssFile(WB_URL.'/modules/miniform/backend.css');
// Look for language file
if (LANGUAGE_LOADED) {
require_once __DIR__.'/languages/EN.php';
if (file_exists($sLangFile = __DIR__.'/languages/'.LANGUAGE.'.php'))
require_once $sLangFile;
}
$sUrlTrail = $_SERVER['PHP_SELF'].'?page_id='.$page_id.'&section_id='.$section_id;
// archive record?
if(!isset($_GET['order_id']) || !is_numeric($_GET['order_id'])){
die();
}
$iOrderID = intval($_GET['order_id']);
//$sOutput = cartContentRaw($_GET['order_id']);
$view = "single";
?>
<h2><?=$TXT_BAKERY['REQUESTS']; ?>-ID <?=$iOrderID?></h2>
<div class="content-box">
<table id="mf_msgs_<?=$section_id ?>" class="mf_messages" cellpadding="2" cellspacing="0" border="0" width="100%">
<?php
$rec = $database->get_array("SELECT * FROM `{BXT}_requests` WHERE `order_id` = ".$iOrderID)[0];
$sDate = date(DATE_FORMAT.' - '.TIME_FORMAT,$rec['timestamp']+TIMEZONE);
?>
<tr class="setline">
<td><a href="<?=WB_URL?>/modules/bakery/modify_single_request.php?page_id=<?=$page_id.'&section_id='.$section_id.'&order_id='.$rec['order_id'];?>"></a>
<a class="msg_toggle" rel="<?=$rec['request_id']?>" title="<?=$TXT_BAKERY['REQUESTS']?>-ID: <?=$rec['request_id']?>" href="#request_id_<?=$rec['request_id']?>">
<span class="icon">✉</span>
<small>ID: <?=$rec['request_id']?></small>
<b><?=$rec['first_name']?> <?=$rec['last_name']?></b>, <i><?=$rec['email']?></i>
</a>
</td>
<td align="right">
<small><i><?=$TEXT['DATE'].': <b>'.$sDate?></b></i></small>
</td>
<td align="right" class="delete_submission">
<a href="javascript: confirm_link('<?=$TEXT['ARE_YOU_SURE']; ?>', '<?=$sUrlTrail?>&delete=<?=$rec['request_id']?>');" class="del_icon" title="<?=$TEXT['DELETE']?>"><i class="fa fa-times"></i></a>
<?php if($view == 'archive'): ?>
<a href="<?=$sUrlTrail?>&recover=<?=$rec['request_id']?>" class="arch_icon"><i class="fa fa-reply"></i></a>
<?php else: ?>
<a href="<?=$sUrlTrail?>&archive=<?=$rec['request_id']?>" class="arch_icon"><i class="fa fa-archive"></i></a>
<?php endif; ?>
</td>
</tr>
<tr id="request_id_<?=$rec['request_id']?>" <?php /* style="display:block;"*/?>>
<td colspan="3">
<div class="req-content">
<table style="width: 100%">
<?php
$sCustomerMessage = 'n/a';
$aDetails = json_decode($rec['json'], 1);
$address_start = false;
foreach($aDetails as $key=>$val):
if($key == 'user_id') continue;
if($key == 'order_id'){
$iOrderID = $val;
continue;
}
if($key == 'cust_message'){
$sCustomerMessage = $val;
continue;
}
$str = $key;
$str = str_replace('ship', 'cust', $str);
if(array_key_exists(strtoupper($str), $TXT_BAKERY)){
$str = $TXT_BAKERY[strtoupper($str)];
}
if(strpos($key, 'ship') !== false && $address_start != true){
$address_start = true;
echo '<tr><td colspan="2" style="font-size:115%">'.$TXT_BAKERY['SHIP_ADDRESS'].'</td></tr>';
}
?>
<tr>
<td style="width:25%;font-weight:bold; text-align: right;padding-right:8px;">
<span title="<?=$key?>"><?= $str ?></span>:
</td>
<td>
<?=$val?>
</td>
</tr>
<?php endforeach;?>
</table>
<?php
$tmpCart = $database->get_one(
"SELECT `json_order` FROM `{BXT}_customer` WHERE `order_id` = ".$rec['order_id']
);
$aCart = json_decode($tmpCart, 1);
if(!empty($aCart['items'])):
?>
<table style="width: 95%;margin:10px;border:1px solid #ccc">
<thead>
<tr>
<th><?=$TXT_BAKERY['SKU']?></th>
<th></th>
<th><?=$TXT_BAKERY['NAME']?></th>
<th><?=$TXT_BAKERY['PRICE']?></th>
<th><?=$TXT_BAKERY['QUANTITY']?></th>
<th><?=$TXT_BAKERY['SHIPPING']?></th>
<th><?=$TXT_BAKERY['SUM']?></th>
</tr>
</thead>
<?php
foreach($aCart['items'] as $item):
// check if item-file exists and create correct link
if(is_readable(WB_PATH . PAGES_DIRECTORY . $item['link']))
$item['link'] = WB_URL . PAGES_DIRECTORY . $item['link'];
else
$item['link'] = '';
// check if item-image exists and create correct source
if(is_readable(WB_PATH . MEDIA_DIRECTORY . $item['thumb_url']))
$item['thumb_url'] = WB_URL . MEDIA_DIRECTORY . $item['thumb_url'];
else
$item['thumb_url'] = WB_URL.'/modules/bakery/images/nopic.jpg';
?>
<tr>
<td><?=$item['sku']?></td>
<td><img src="<?=$item['thumb_url']?>" width="75"></td>
<td>
<?php if($item['link'] != ''): ?>
<a href="<?=$item['link']?>"><?=$item['name']?></a>
<?php else: ?>
<?=$item['name']?> <i class="fa fa-exclamation-circle" style="color:red;" title="item no longer available"></i>
<?php endif; ?>
<?php if($item['show_attribute'] != ''):?><br><?=$item['show_attribute']?><?php endif; ?>
</td>
<td><?=$item['f_price']?></td>
<td><?=$item['quantity']?></td>
<td><?=$item['f_shipping']?></td>
<td><?=$item['f_item_total']?></td>
</tr>
<?php
endforeach;
?>
<tfoot>
<tr>
<th colspan="7" align="right"><?=$sCurrency.' '.$TXT_BAKERY['TOTAL']?>: <big><?=$aCart['f_order_total']?></big></th>
</tr>
</tfoot>
</table>
<b><?=$TXT_BAKERY['CUST_MESSAGE']?>: </b>
<?=$sCustomerMessage == '' ? $TEXT['NONE'] : $sCustomerMessage?>
<?php else: ?>
<?php endif; ?>
</div>
</td>
</tr>
</tbody>
</table>
<br>
<a class="button" href="<?=WB_URL.'/modules/bakery/modify_requests.php?page_id='.$page_id.'§ion_id='.$section_id?>">« <?=$TXT_BAKERY['REQUESTS']; ?></a>
<script>
/*
$(function() {
$(".msg_toggle").click(function(e){
e.preventDefault();
var openID = $(this).attr('rel');
$("tr#request_id_"+openID + " div.req-content").slideToggle();
console.log("click "+openID);
});
});
*/
</script>
</div>
<?php
// Print admin footer
$admin->print_footer();