Skip to content

Commit 6836a29

Browse files
committed
changed UI
1 parent 78249f1 commit 6836a29

File tree

13 files changed

+340469
-349
lines changed

13 files changed

+340469
-349
lines changed

app/Listeners/StoreCsvUploadData.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ public function handle(CsvUploadData $event): void
3333

3434
#Ensure csv has headers to iterate through
3535
$reader->setHeaderOffset(0);
36+
$records = $reader->getRecords();
3637

3738
$locations = [];
3839

39-
foreach ($reader as $record) {
40+
foreach ($records as $record) {
4041
$locations[] = [
4142
'Street_Address' => preg_replace('/[^a-zA-Z0-9 ]/m', '', $record['Street_Address']),# Since we have some special characters
4243
'Postcode' => $record['Postcode'],
@@ -50,7 +51,7 @@ public function handle(CsvUploadData $event): void
5051
foreach (array_chunk($locations, 1000) as $locationChunk) {
5152
CsvUpload::insert($locationChunk);
5253
}
53-
54+
5455
#Delete the file after processing
5556
/**
5657
* We shall insert all processed data to database to track record

public/build/assets/app-cf394b53.js renamed to public/build/assets/app-147eba56.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-6454d4a3.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import"https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap";@import"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css";

public/build/assets/app-a1f176bd.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/build/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resources/css/app.css": {
3-
"file": "assets/app-a1f176bd.css",
3+
"file": "assets/app-6454d4a3.css",
44
"isEntry": true,
55
"src": "resources/css/app.css"
66
},
@@ -12,7 +12,7 @@
1212
"css": [
1313
"assets/app-1f469613.css"
1414
],
15-
"file": "assets/app-cf394b53.js",
15+
"file": "assets/app-147eba56.js",
1616
"isEntry": true,
1717
"src": "resources/js/app.js"
1818
}

public/uploads/64a2ad65e1bc5_1688382821.csv

Lines changed: 170122 additions & 0 deletions
Large diffs are not rendered by default.

public/uploads/64a2bceb4ff93_1688386795.csv

Lines changed: 170122 additions & 0 deletions
Large diffs are not rendered by default.

resources/css/app.css

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,171 +1,3 @@
11
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap');
22

33
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css");
4-
/*
5-
6-
7-
/*
8-
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css'); */
9-
10-
body{
11-
font-family: 'Open Sans', sans-serif;
12-
/* background-image: url("https://laracasts.com/images/forum/upper-gradient.svg"); */
13-
background-image: linear-gradient(to right,#846699, #ac7aac);
14-
}
15-
.search{
16-
top:6px;
17-
left:10px;
18-
}
19-
20-
.form-control{
21-
22-
border:none;
23-
padding-left:32px;
24-
}
25-
26-
.form-control:focus{
27-
28-
border:none;
29-
box-shadow:none;
30-
}
31-
32-
.green{
33-
34-
color:green;
35-
}
36-
37-
.red{
38-
39-
color:tomato;
40-
}
41-
42-
nav {
43-
background: rgba(0, 0, 0, 0.9);
44-
padding: 20px;
45-
display: flex;
46-
justify-content: space-between;
47-
color: #fff;
48-
position: relative;
49-
z-index: 99;
50-
}
51-
52-
.fas {
53-
cursor: pointer;
54-
}
55-
56-
.menu-icon {
57-
display: none;
58-
font-size: 20px;
59-
}
60-
.menu-icon .fa-times {
61-
transform: rotate(360deg);
62-
transition: all 0.2s ease-in-out;
63-
}
64-
65-
.menu-icon .fa-bars {
66-
transform: rotate(180deg);
67-
transition: all 0.2s ease-in-out;
68-
}
69-
70-
.logo {
71-
font-weight: 600;
72-
font-size: 25px;
73-
color: tomato;
74-
font-family: "Tangerine", sans-serif;
75-
}
76-
77-
.logo font {
78-
color: #fff;
79-
font-family: "Tangerine", sans-serif;
80-
}
81-
82-
.menu-list {
83-
list-style-type: none;
84-
display: flex;
85-
justify-content: space-between;
86-
align-items: center;
87-
}
88-
89-
.menu-list li:last-child a {
90-
font-weight: 300;
91-
padding: 5px 10px;
92-
background-color: #01aacd;
93-
transition: all 0.5s ease-in-out;
94-
margin-left: 20px;
95-
border-radius: 2px;
96-
}
97-
98-
.menu-list li a {
99-
text-decoration: none;
100-
color: #fff;
101-
font-weight: 300;
102-
padding: 5px 10px;
103-
margin-left: 20px;
104-
}
105-
106-
.menu-list li a:hover,
107-
.menu-list li a.active {
108-
background-color: #fff;
109-
border-radius: 2px;
110-
color: #000;
111-
transition: all 0.5s ease-in-out;
112-
}
113-
114-
.sticky {
115-
position: -webkit-sticky;
116-
position: sticky;
117-
top: 0;
118-
}
119-
120-
.bg-gray{
121-
background-image: linear-gradient(to right, gray, white);
122-
}
123-
124-
@media screen and (max-width: 800px) {
125-
.logo {
126-
font-size: 20px;
127-
}
128-
.menu-list li a {
129-
font-size: 14px;
130-
margin-left: 10px;
131-
}
132-
}
133-
134-
@media screen and (max-width: 600px) {
135-
.menu-icon {
136-
display: block;
137-
}
138-
.menu-list {
139-
flex-direction: column;
140-
width: 100%;
141-
position: absolute;
142-
background: rgba(0, 0, 0, 0.7);
143-
padding: 20px;
144-
right: 0;
145-
top: 64px;
146-
transition: all 0.5s ease-in-out;
147-
}
148-
149-
.menu-list li {
150-
margin-bottom: 20px;
151-
width: 100%;
152-
text-align: center;
153-
}
154-
.menu-list li:last-child {
155-
margin-bottom: 0px;
156-
}
157-
158-
.menu-list li a,
159-
.menu-list li:last-child a {
160-
width: 100px;
161-
display: block;
162-
margin: auto;
163-
}
164-
165-
.menu-list.close {
166-
right: -100%;
167-
transition: all 0.5s ease-in-out;
168-
}
169-
}
170-
171-

resources/js/components/form.js

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import 'jquery/dist/jquery.min.js';
22
import $ from 'jquery';
33
import jQuery from 'jquery';
44

5-
jQuery(function() {
6-
$('#submitButton').on('click',function(e) {
5+
jQuery(function () {
6+
$('#submitButton').on('click', function (e) {
77
e.preventDefault();
88
const postcode = $('#postcode').val();
99
const api_key = $('#api_key').val();
@@ -16,70 +16,73 @@ jQuery(function() {
1616

1717
const fullUrl = url + '?' + param;
1818

19-
fetchPostcodes();
20-
21-
function fetchPostcodes() {
22-
$.ajax({
23-
type: "GET",
24-
"url": `${fullUrl}`,
25-
// 'data' : `${param}`,
26-
dataType: "json",
27-
"headers": {
28-
"Accept": "application/vnd.api+json",
29-
"Accept": "application/x-www-form-urlencoded"
30-
},
31-
success: function(response) {
32-
// console.log(response.locations);
33-
// console.log(response.status);
34-
$('#message').html('');
35-
$('#message').removeClass('alert alert-warning alert-dismissible fade show');
36-
37-
$('#success').html('');
38-
$('#success').addClass('alert alert-success alert-dismissible fade show');
39-
$('#success').append('<span><strong>Message! </strong>' + response.status + '</span>');
40-
41-
$('<tr class="bg-light">\
42-
<th scope="col" >ID</th>\
43-
<th scope="col" >Lat</th>\
44-
<th scope="col" >Long</th>\
45-
<th scope="col" >Street_Address</th>\
46-
</tr>').appendTo('thead');
47-
48-
$('Table').html('');
49-
$.map(response.locations, function ({Lat, Long, Postcode, Street_Address }, index) {
50-
$('Table').append('<tr key=`${index}`>\
51-
<td scope="row">'+index+'</td>\
52-
<td>'+Lat+'</td>\
53-
<td><i class="bi bi-check2-circle green"></i><span class="ms-1">'+ Long +'</span></td>\
54-
<td>'+Street_Address+'</td>\
55-
</tr>'
56-
);
57-
});
58-
59-
$('#postcode').val('');
60-
$('#api_key').val('');
61-
},
62-
error: function(jqXHR, status, error) {
63-
64-
const errors = jqXHR.responseJSON.status;
65-
66-
$('Table').html('');
67-
68-
$('#success').html('');
69-
$('#success').removeClass('alert alert-success alert-dismissible fade show');
70-
71-
$('#message').html('');
72-
$('#message').addClass(
73-
'alert alert-warning alert-dismissible fade show');
74-
$('#message').append('<span><strong>Message! </strong>' +
75-
errors +
76-
'</span>');
77-
78-
// $('#postcode').val('');
79-
// $('#api_key').val('');
80-
}
81-
});
82-
}
19+
fetchPostcodes();
20+
21+
function fetchPostcodes() {
22+
$.ajax({
23+
type: "GET",
24+
"url": `${fullUrl}`,
25+
// 'data' : `${param}`,
26+
dataType: "json",
27+
"headers": {
28+
"Accept": "application/vnd.api+json",
29+
"Accept": "application/x-www-form-urlencoded"
30+
},
31+
success: function (response) {
32+
33+
$('#message').html('');
34+
$('#message').removeClass('alert alert-warning alert-dismissible fade show');
35+
36+
$('#success').html('');
37+
$('#success').addClass('alert alert-success alert-dismissible fade show');
38+
$('#success').append('<span><strong>Message! </strong>' + response.status + '</span>');
39+
40+
$('table').html('');
41+
42+
$('table').append('<thead>\
43+
<tr>\
44+
<th scope="col">ID</th>\
45+
<th scope="col">Lat</th>\
46+
<th scope="col">Long</th>\
47+
<th scope="col">Street_Address</th>\
48+
</tr>\
49+
</thead>');
50+
51+
$.map(response.locations, function ({ Lat, Long, Street_Address }, index) {
52+
$('table').append('<tbody>\
53+
<tr key=`${index}`>\
54+
<td scope="row">'+ index + '</td>\
55+
<td>'+ Lat + '</td>\
56+
<td><i class="bi bi-check2-circle green"></i><span class="ms-1">'+ Long + '</span></td>\
57+
<td>'+ Street_Address + '</td>\
58+
</tr>\
59+
</tbody>');
60+
});
61+
62+
$('#postcode').val('');
63+
$('#api_key').val('');
64+
},
65+
error: function (jqXHR, status, error) {
66+
67+
const errors = jqXHR.responseJSON.status;
68+
69+
$('table').html('');
70+
71+
$('#success').html('');
72+
$('#success').removeClass('alert alert-success alert-dismissible fade show');
73+
74+
$('#message').html('');
75+
$('#message').addClass(
76+
'alert alert-warning alert-dismissible fade show');
77+
$('#message').append('<span><strong>Message! </strong>' +
78+
errors +
79+
'</span>');
80+
81+
// $('#postcode').val('');
82+
// $('#api_key').val('');
83+
}
84+
});
85+
}
8386

8487
});
8588
});

0 commit comments

Comments
 (0)