-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin-voucher.php
286 lines (237 loc) · 12.2 KB
/
admin-voucher.php
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?php
/************** BASIC CONFIG *************************/
define('_VALID_PHP', true);
$pname = 'Voucher Management';
$menu = 'ADMIN_BIDDING';
$submenu = 'ADMIN_BIDDING_CLAIM';
require_once 'init.php';
use Carbon\Carbon;
if (!$user->logged_in) {
//redirect_to(SITEURL.'/index.php');
}
if(isset($_GET['id']) && $_GET['id'] != ''){
$id = $_GET['id'];
$claim_detail = $fz->getClaimByID2($id);
}else{
rd('admin-instantclaim.php');
}
/************** END BASIC CONFIG *********************/
?>
<?php include BACK_INC.'header.php'; ?>
<body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo">
<?php include BACK_INC.'htmlheader.php'; ?>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php include BACK_INC.'menu.php'; ?>
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEAD-->
<div class="page-head">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1><?php echo $pname; ?>
<small>
<!-- bootstrap form controls and more -->
</small>
</h1>
</div>
<!-- END PAGE TITLE -->
</div>
<!-- END PAGE HEAD-->
<!-- BEGIN PAGE BREADCRUMB -->
<ul class="page-breadcrumb breadcrumb">
<li>
<a href="admin-dashboard.php">Dashboard</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span>Bidding</span>
<i class="fa fa-circle"></i>
</li>
<li>
<a href="admin-instantclaim.php">Instant Claim List</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span class="active"><?php echo $pname; ?></span>
</li>
</ul>
<!-- END PAGE BREADCRUMB -->
<!-- BEGIN PAGE BASE CONTENT -->
<div class="row">
<div class="col-md-12 ">
<!-- BEGIN SAMPLE FORM PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-red-sunglo">
<i class="icon-settings font-red-sunglo"></i>
<span class="caption-subject bold uppercase"><?php echo $claim_detail->title; ?> </span>
</div>
</div>
<div class="portlet-body form">
<div id="getting-started"></div>
<div class="row">
<div class="col-md-6">
<h4 class="pull-left">Voucher List</h4>
</div>
<div class="col-md-6">
<div class="btn-group pull-right">
<a class="btn green btn-outline sbold pull-right" data-toggle="modal" href="#modal_voucher"> <i class="fa fa-plus"></i> Voucher Claim</a>
</div>
</div>
<div class="col-md-12">
<?php
if(isset($_SESSION['noti']) && $_SESSION['noti'] != ''){
if($_SESSION['noti']['status'] == 'error'){
echo '<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert"><span>×</span></button>'.$_SESSION['noti']['msg'].'</div>';
}elseif($_SESSION['noti']['status'] == 'success'){
echo '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert"><span>×</span></button>'.$_SESSION['noti']['msg'].'</div>';
}
unset($_SESSION['noti']);
}
$vouchers = $fz->getVoucherByClaimID($id);
?>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th class="text-center" width="25%">Voucher Code</th>
<th class="text-center">Status</th>
<th class="text-center" width="15%">Action</th>
</tr>
</thead>
<tbody>
<?php
foreach($vouchers as $key => $row){
?>
<tr>
<td class="text-center"><?php echo $row->voucher_code; ?></td>
<td class="text-center">
<?php
if($row->cust_id){
$cust_id = $row->cust_id;
$cust_detail = $fz->getUserByID($cust_id);
echo '<label class="label label-success">Claimed</label> by <a class="margin-right-10" href="admin-userprofile.php?id='.$cust_id.'">'.$cust_detail->firstname.' '.$cust_detail->lastname.'</a>'
.'<a href="mailto:'.$cust_detail->email.'" target="_top" class="btn btn-success">Send Voucher</a>'
;
}else{
echo '<label class="label label-danger">Available</label>';
}
?>
</td>
<td class="text-center">
<button class="btn btn-sm btn-warning btn_updateVoucher" id="<?php echo $row->id; ?>"><i class="fa fa-pencil"></i></button>
<button class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<div class="modal fade in" id="modal_voucher" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Upload Voucher Code</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" action="backend/process.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="col-md-3 control-label">Excel File</label>
<div class="col-md-9">
<input type="file" class="form-control input-file-excel" name="excel_voucher" id="excel_voucher">
<span></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-9">
<button type="submit" class="btn blue btn_submit_upload">Upload</button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
<input type="hidden" name="func" value="upload_voucher">
<input type="hidden" name="id" id="claim_id" value="<?php echo $id; ?>">
</form>
</div>
</div>
</div>
</div>
<div class="modal fade in" id="modal_voucher_upd" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Update Voucher Code</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" action="backend/process.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="col-md-3 control-label">Voucher Code</label>
<div class="col-md-9">
<input type="text" class="form-control" name="voucher_code" id="voucher_code_upd">
<span></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-9">
<button type="submit" class="btn blue btn_submit_upload">Update</button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
<input type="hidden" name="claim_id" value="<?php echo $id; ?>">
<input type="hidden" name="func" value="update_voucher">
<input type="hidden" name="id" id="voucher_id" value="">
</form>
</div>
</div>
</div>
</div>
</div>
<!-- here -->
</div>
<!-- END SAMPLE FORM PORTLET-->
</div>
</div>
<!-- END PAGE BASE CONTENT -->
</div>
<!-- END CONTENT BODY -->
</div>
</div>
<!-- END CONTAINER -->
<script type="text/javascript">
$(document).ready(function(){
$('.btn_uploadVoucher').on('click',function(){
$('.input-file-excel').val('');
$('.input-file-excel').parent().removeClass('has-error').find('span').removeClass('text-danger').html('');
$('.btn_submit_upload').prop('disabled',false);
$('#modal_voucher').modal('show');
});
$('.btn_updateVoucher').on('click',function(){
$('#voucher_code_upd').val('');
$('#voucher_id').val('');
var id = $(this).attr('id');
var dataString = "id="+id+"&func=getVoucherByID";
$.ajax({
type : "POST",
url : "backend/process.php",
data : dataString,
cache : false,
dataType: 'json',
success : function(data)
{
$('#voucher_code_upd').val(data.voucher_code);
$('#voucher_id').val(data.id);
$('#modal_voucher_upd').modal('show');
}
});
});
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
});
</script>
<?php include BACK_INC.'htmlfooter.php'; ?>