1 | @extends('crudbooster::admin_template') |
||
2 | @section('content') |
||
3 | |||
4 | |||
5 | @if($button_show_data || $button_reload_data || $button_new_data || $button_delete_data || $index_button || $columns) |
||
6 | <div id='box-actionmenu' class='box'> |
||
7 | <div class='box-body'> |
||
8 | @include("crudbooster::default.actionmenu") |
||
9 | </div> |
||
10 | </div> |
||
11 | @endif |
||
12 | |||
13 | |||
14 | @if(Request::get('file') && Request::get('import')) |
||
15 | |||
16 | <ul class='nav nav-tabs'> |
||
17 | <li style="background:#eeeeee"><a style="color:#111" |
||
18 | onclick="if(confirm('Are you sure want to leave ?')) location.href='{{ CRUDBooster::mainpath("import-data") }}'" |
||
19 | href='javascript:;'><i class='fa fa-download'></i> Upload a File »</a></li> |
||
20 | <li style="background:#eeeeee"><a style="color:#111" href='#'><i class='fa fa-cogs'></i> Adjustment »</a></li> |
||
21 | <li style="background:#ffffff" class='active'><a style="color:#111" href='#'><i class='fa fa-cloud-download'></i> Importing »</a></li> |
||
22 | </ul> |
||
23 | |||
24 | <!-- Box --> |
||
25 | <div id='box_main' class="box box-primary"> |
||
26 | <div class="box-header with-border"> |
||
27 | <h3 class="box-title">Importing</h3> |
||
28 | <div class="box-tools"> |
||
29 | </div> |
||
30 | </div> |
||
31 | |||
32 | <div class="box-body"> |
||
33 | |||
34 | <p style='font-weight: bold' id='status-import'><i class='fa fa-spin fa-spinner'></i> Please wait importing...</p> |
||
35 | <div class="progress"> |
||
36 | <div id='progress-import' class="progress-bar progress-bar-primary progress-bar-striped" role="progressbar" aria-valuenow="40" |
||
37 | aria-valuemin="0" aria-valuemax="100" style="width: 0%"> |
||
38 | <span class="sr-only">40% Complete (success)</span> |
||
39 | </div> |
||
40 | </div> |
||
41 | |||
42 | @push('bottom') |
||
43 | <script type="text/javascript"> |
||
44 | $(function () { |
||
45 | var total = {{ intval(Session::get('total_data_import')) }}; |
||
46 | |||
47 | var int_prog = setInterval(function () { |
||
48 | |||
49 | $.post("{{ CRUDBooster::mainpath('do-import-chunk?file='.Request::get('file')) }}", {resume: 1}, function (resp) { |
||
50 | console.log(resp.progress); |
||
51 | $('#progress-import').css('width', resp.progress + '%'); |
||
52 | $('#status-import').html("<i class='fa fa-spin fa-spinner'></i> Please wait importing... (" + resp.progress + "%)"); |
||
53 | $('#progress-import').attr('aria-valuenow', resp.progress); |
||
54 | if (resp.progress >= 100) { |
||
55 | $('#status-import').addClass('text-success').html("<i class='fa fa-check-square-o'></i> Import Data Completed !"); |
||
56 | clearInterval(int_prog); |
||
57 | } |
||
58 | }) |
||
59 | |||
60 | |||
61 | }, 2500); |
||
62 | |||
63 | $.post("{{ CRUDBooster::mainpath('do-import-chunk').'?file='.Request::get('file') }}", function (resp) { |
||
64 | if (resp.status == true) { |
||
65 | $('#progress-import').css('width', '100%'); |
||
66 | $('#progress-import').attr('aria-valuenow', 100); |
||
67 | $('#status-import').addClass('text-success').html("<i class='fa fa-check-square-o'></i> Import Data Completed !"); |
||
68 | clearInterval(int_prog); |
||
69 | $('#upload-footer').show(); |
||
70 | console.log('Import Success'); |
||
71 | } |
||
72 | }) |
||
73 | |||
74 | }) |
||
75 | |||
76 | </script> |
||
77 | @endpush |
||
78 | |||
79 | </div><!-- /.box-body --> |
||
80 | |||
81 | <div class="box-footer" id='upload-footer' style="display:none"> |
||
82 | <div class='pull-right'> |
||
83 | <a href='{{ CRUDBooster::mainpath("import-data") }}' class='btn btn-default'><i class='fa fa-upload'></i> Upload Other File</a> |
||
84 | <a href='{{CRUDBooster::mainpath()}}' class='btn btn-success'>Finish</a> |
||
85 | </div> |
||
86 | </div><!-- /.box-footer--> |
||
87 | |||
88 | </div><!-- /.box --> |
||
89 | @endif |
||
90 | |||
91 | @if(Request::get('file') && !Request::get('import')) |
||
92 | |||
93 | <ul class='nav nav-tabs'> |
||
94 | <li style="background:#eeeeee"><a style="color:#111" |
||
95 | onclick="if(confirm('Are you sure want to leave ?')) location.href='{{ CRUDBooster::mainpath("import-data") }}'" |
||
96 | href='javascript:;'><i class='fa fa-download'></i> Upload a File »</a></li> |
||
97 | <li style="background:#ffffff" class='active'><a style="color:#111" href='#'><i class='fa fa-cogs'></i> Adjustment »</a></li> |
||
98 | <li style="background:#eeeeee"><a style="color:#111" href='#'><i class='fa fa-cloud-download'></i> Importing »</a></li> |
||
99 | </ul> |
||
100 | |||
101 | <!-- Box --> |
||
102 | <div id='box_main' class="box box-primary"> |
||
103 | <div class="box-header with-border"> |
||
104 | <h3 class="box-title">Adjustment</h3> |
||
105 | <div class="box-tools"> |
||
106 | |||
107 | </div> |
||
108 | </div> |
||
109 | |||
110 | <?php |
||
111 | if ($data_sub_module) { |
||
112 | $action_path = Route($data_sub_module->controller."GetIndex"); |
||
113 | } else { |
||
114 | $action_path = CRUDBooster::mainpath(); |
||
0 ignored issues
–
show
|
|||
115 | } |
||
116 | |||
117 | $action = $action_path."/done-import?file=".Request::get('file').'&import=1'; |
||
118 | ?> |
||
119 | |||
120 | <form method='post' id="form" enctype="multipart/form-data" action='{{$action}}'> |
||
121 | <input type="hidden" name="_token" value="{{ csrf_token() }}"> |
||
122 | <div class="box-body table-responsive no-padding"> |
||
123 | <div class='callout callout-info'> |
||
124 | * Just ignoring the column where you are not sure the data is suit with the column or not.<br/> |
||
125 | * Warning !, Unfortunately at this time, the system can't import column that contains image or photo url. |
||
126 | </div> |
||
127 | @push('head') |
||
128 | <style type="text/css"> |
||
129 | th, td { |
||
130 | white-space: nowrap; |
||
131 | } |
||
132 | </style> |
||
133 | @endpush |
||
134 | <table class='table table-bordered' style="width:130%"> |
||
135 | <thead> |
||
136 | <tr class='success'> |
||
137 | @foreach($table_columns as $k=>$column) |
||
138 | <?php |
||
139 | $help = ''; |
||
140 | if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') continue; |
||
141 | if (substr($column, 0, 3) == 'id_') { |
||
142 | $relational_table = substr($column, 3); |
||
143 | $help = "<a href='#' title='This is foreign key, so the System will be inserting new data to table `$relational_table` if doesn`t exists'><strong>(?)</strong></a>"; |
||
144 | } |
||
145 | ?> |
||
146 | <th data-no-column='{{$k}}'>{{ $column }} {!! $help !!}</th> |
||
147 | @endforeach |
||
148 | </tr> |
||
149 | </thead> |
||
150 | <tbody> |
||
151 | |||
152 | <tr> |
||
153 | @foreach($table_columns as $k=>$column) |
||
154 | <?php if ($column == 'id' || $column == 'created_at' || $column == 'updated_at' || $column == 'deleted_at') continue;?> |
||
155 | <td data-no-column='{{$k}}'> |
||
156 | <select style='width:120px' class='form-control select_column' name='select_column[{{$k}}]'> |
||
157 | <option value=''>** Set Column for {{$column}}</option> |
||
158 | @foreach($data_import_column as $import_column) |
||
159 | <option value='{{$import_column}}'>{{$import_column}}</option> |
||
160 | @endforeach |
||
161 | </select> |
||
162 | </td> |
||
163 | @endforeach |
||
164 | </tr> |
||
165 | </tbody> |
||
166 | </table> |
||
167 | |||
168 | |||
169 | </div><!-- /.box-body --> |
||
170 | |||
171 | @push('bottom') |
||
172 | <script type="text/javascript"> |
||
173 | $(function () { |
||
174 | var total_selected_column = 0; |
||
175 | setInterval(function () { |
||
176 | total_selected_column = 0; |
||
177 | $('.select_column').each(function () { |
||
178 | var n = $(this).val(); |
||
179 | if (n) total_selected_column = total_selected_column + 1; |
||
180 | }) |
||
181 | }, 200); |
||
182 | }) |
||
183 | |||
184 | function check_selected_column() { |
||
185 | var total_selected_column = 0; |
||
186 | $('.select_column').each(function () { |
||
187 | var n = $(this).val(); |
||
188 | if (n) total_selected_column = total_selected_column + 1; |
||
189 | }) |
||
190 | if (total_selected_column == 0) { |
||
191 | swal("Oops...", "Please at least 1 column that should adjusted...", "error"); |
||
192 | return false; |
||
193 | } else { |
||
194 | return true; |
||
195 | } |
||
196 | } |
||
197 | </script> |
||
198 | @endpush |
||
199 | |||
200 | <div class="box-footer"> |
||
201 | <div class='pull-right'> |
||
202 | <a onclick="if(confirm('Are you sure want to leave ?')) location.href='{{ CRUDBooster::mainpath("import-data") }}'" href='javascript:;' |
||
203 | class='btn btn-default'>Cancel</a> |
||
204 | <input type='submit' class='btn btn-primary' name='submit' onclick='return check_selected_column()' value='Import Data'/> |
||
205 | </div> |
||
206 | </div><!-- /.box-footer--> |
||
207 | </form> |
||
208 | </div><!-- /.box --> |
||
209 | |||
210 | |||
211 | @endif |
||
212 | |||
213 | @if(!Request::get('file')) |
||
214 | <ul class='nav nav-tabs'> |
||
215 | <li style="background:#ffffff" class='active'><a style="color:#111" |
||
216 | onclick="if(confirm('Are you sure want to leave ?')) location.href='{{ CRUDBooster::mainpath("import-data") }}'" |
||
217 | href='javascript:;'><i class='fa fa-download'></i> Upload a File »</a></li> |
||
218 | <li style="background:#eeeeee"><a style="color:#111" href='#'><i class='fa fa-cogs'></i> Adjustment »</a></li> |
||
219 | <li style="background:#eeeeee"><a style="color:#111" href='#'><i class='fa fa-cloud-download'></i> Importing »</a></li> |
||
220 | </ul> |
||
221 | |||
222 | <!-- Box --> |
||
223 | <div id='box_main' class="box box-primary"> |
||
224 | <div class="box-header with-border"> |
||
225 | <h3 class="box-title">Upload a File</h3> |
||
226 | <div class="box-tools"> |
||
227 | |||
228 | </div> |
||
229 | </div> |
||
230 | |||
231 | <?php |
||
232 | if ($data_sub_module) { |
||
233 | $action_path = Route($data_sub_module->controller."GetIndex"); |
||
234 | } else { |
||
235 | $action_path = CRUDBooster::mainpath(); |
||
236 | } |
||
237 | |||
238 | $action = $action_path."/do-upload-import-data"; |
||
239 | ?> |
||
240 | |||
241 | <form method='post' id="form" enctype="multipart/form-data" action='{{$action}}'> |
||
242 | <input type="hidden" name="_token" value="{{ csrf_token() }}"> |
||
243 | <div class="box-body"> |
||
244 | |||
245 | <div class='callout callout-success'> |
||
246 | <h4>Welcome to Data Importer Tool</h4> |
||
247 | Before doing upload a file, its better to read this bellow instructions : <br/> |
||
248 | * File format should be : xls or xlsx or csv<br/> |
||
249 | * If you have a big file data, we can't guarantee. So, please split those files into some parts of file (at least max 5 MB).<br/> |
||
250 | * This tool is generate data automatically so, be carefull about your table xls structure. Please make sure correctly the table |
||
251 | structure.<br/> |
||
252 | * Table structure : Line 1 is heading column , and next is the data. (For example, you can export any module you wish to XLS format) |
||
253 | </div> |
||
254 | |||
255 | <div class='form-group'> |
||
256 | <label>File XLS / CSV</label> |
||
257 | <input type='file' name='userfile' class='form-control' required/> |
||
258 | <div class='help-block'>File type supported only : XLS, XLSX, CSV</div> |
||
259 | </div> |
||
260 | </div><!-- /.box-body --> |
||
261 | |||
262 | <div class="box-footer"> |
||
263 | <div class='pull-right'> |
||
264 | <a href='{{ CRUDBooster::mainpath() }}' class='btn btn-default'>Cancel</a> |
||
265 | <input type='submit' class='btn btn-primary' name='submit' value='Upload'/> |
||
266 | </div> |
||
267 | </div><!-- /.box-footer--> |
||
268 | </form> |
||
269 | </div><!-- /.box --> |
||
270 | |||
271 | |||
272 | @endif |
||
273 | </div><!-- /.col --> |
||
274 | |||
275 | |||
276 | </div><!-- /.row --> |
||
277 | |||
278 | @endsection |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths