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
|
<?php $GLOBALS["datetimepicker"] = 1; $GLOBALS["select2"] = 1;
$page_setting = array( 'controller' => current_controller(), 'table' => $table, 'languages' => $languages, 'permission' => $permission, 'page' => $page, );
validate_user_access(array($page_setting['permission']['view']), 0);
include_once 'templates/top.php'; ?>
<!-- Content Header (Page header) --> <section class="content-header"> <h1> <?php echo __(ucfirst(str_replace('_', ' ', $table))); ?> </h1> <ol class="breadcrumb"> <li><a href="<?php echo admin_url(''); ?>"><?php echo __('Home'); ?></a></li> <li><a href="<?php echo admin_url($page_setting['controller']); ?>"><?php echo __(ucfirst(str_replace('_', ' ', $table))); ?></a></li> </ol> </section>
<!-- Main content --> <section class="content mt-10"> <div class="box box-default"> <div class="box-body"> <div class="row mt-30"> <div class="col-md-12"> <!-- start report --> <?php echo form_open(admin_url($page_setting['controller'] . '/export'), 'id="export_form" target="report_window"'); ?> <div class="row"> <div class="col-sm-2"> <?php echo __('From') ?>:</br><input name="from" class="form-control datepicker" style="background-color:#FFF" type="input" value="<?php echo date('Y-01-01'); ?>" readonly> </div> <div class="col-sm-2"> <?php echo __('To') ?>:</br><input name="to" class="form-control datepicker" style="background-color:#FFF" type="input" value="<?php echo date('Y-m-d'); ?>" readonly> </div>
<div class="col-sm-1"> <br/><button type="button" id="excel_export" class="btn btn-success pull-right" style="margin-bottom: 10px;"><?php echo __('Export'); ?></button> </div> </div>
<div class="col-sm-12"> <hr/> </div> <?php echo form_close(); ?> <!-- end report -->
<!-- start search --> <div class="row"> <?php echo form_open(admin_url($page_setting['controller'] . '/index'), 'id="search_form" class="form-horizontal"'); ?> <?php $field = 'application_id'; ?> <div class="col-md-4"> <h5 class="mb-5"><?php echo $name_fields[$field]; ?>:</h5> <select type="text" name="searches[<?php echo $field; ?>]" value="<?php echo empty($searches[$field]) ? '' : $searches[$field]; ?>" class="form-control select2"> <option value="0"><?php echo __('All'); ?></option> <?php foreach ($applications as $row) { ?> <?php $selected = ""; if ($searches[$field] == $row['id']) { $selected = "selected"; } ?> <option value="<?php echo $row['id']; ?>" <?php echo $selected; ?>><?php echo $row['reference_no']; ?></option> <?php } ?> </select> </div>
<?php $field = 'category_id'; ?> <div class="col-md-4"> <h5 class="mb-5"><?php echo $name_fields[$field]; ?>:</h5> <select type="text" name="searches[<?php echo $field; ?>]" value="<?php echo empty($searches[$field]) ? '' : $searches[$field]; ?>" class="form-control select2"> <option value="0"><?php echo __('All'); ?></option> <?php foreach ($categories as $row) { ?> <?php $selected = ""; if ($searches[$field] == $row['id']) { $selected = "selected"; } ?> <option value="<?php echo $row['id']; ?>" <?php echo $selected; ?>><?php echo $row['name_' . get_lang()]; ?></option> <?php } ?> </select> </div>
<div class="col-md-1"> <h5 class="mb-5"> </h5> <button type="submit" class="btn btn-primary" type="button"> <?php echo __('Search'); ?> </button> </div> <?php echo form_close(); ?> </div> <!-- end search -->
<div class="row"> <?php echo $page_links; ?> </div>
<div class="box-body table-responsive no-padding"> <table class="table table-hover"> <tbody> <tr> <?php if(!in_array('sort', $block_methods)){ ?> <th style="width: 5%;"><?php echo __('Sort'); ?></th> <?php } ?>
<?php foreach ($loop_fields = array('reference_no', 'category_id', 'total', 'count') as $field){ ?> <th><?php echo $name_fields[$field]; ?></th> <?php } ?> <?php foreach ($judges as $judge) { ?> <th><?php echo $judge['name']; ?></th> <?php } ?> </tr>
<?php foreach ($model as $row) { // $modify_onclick = validate_user_access(array($page_setting['permission']['update'])) && !in_array('modify', $block_methods) ? 'onclick="window.location.href=\'' . admin_url($page_setting['controller'] . '/modify/' . $row['id'], 'webadmin') .'\'"' : ''; ?> <tr> <?php if(!in_array('sort', $block_methods)){ ?> <td> <input type="number" name="sort[<?php echo $row['id'] ?>]" min="1" value="<?php echo $row["sort"] ?>" style="width: 50px;"/> </td> <?php } ?>
<?php foreach ($loop_fields as $field){ ?> <?php if ($field == 'category_id') { $display = Category_model::get_certain($row[$field])['name_' . get_lang()]; } else { $display = $row[$field]; } ?> <td> <?php echo $display; ?> </td> <?php } ?>
<?php foreach ($judges as $judge) { ?> <?php $a_perfix = '<a href="' . admin_url('bk_score/detial/' . $row['application_id'] . '/' . $judge['id']) .'" target="_blank">'; $a_suffix = '</a>'; ?> <td> <?php echo $a_perfix . $row['judge'][$judge['id']] . $a_suffix; ?> </td> <?php } ?> </tr> <?php }?> </tbody> </table> </div>
<div class="row"> <?php echo $page_links; ?> </div> </div> </div> </div> <div class="clear"> </div> </div> </section> <!-- /.content --> <?php include_once 'templates/bottom.php'; ?> <script> $('#excel_export').click(function(e) { submit_once = false; var this_form = $(this).parentsUntil('form').parent(); this_form.attr('target', this_form.attr('target').replace('index', 'export_form')); var from = $('input[name="from"]').val(); var to = $('input[name="to"]').val();
if(from && to && from <= to){ alertify.success("<?php echo __('Exporting...') ?>"); $('#export_form').submit(); }else{ alertify.error("<?php echo __('Please enter validated ') . __('date') ?>"); } submit_once = true; }); </script>
|