Add a lot
This commit is contained in:
13
static/css/materialize.min.css
vendored
Normal file
13
static/css/materialize.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,55 +1,37 @@
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
main {
|
||||
background: #F1F1F1;
|
||||
}
|
||||
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
.nav-add {
|
||||
padding-top: 12px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
body {
|
||||
line-height: 1;
|
||||
img.add-contacts {
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
.row .col.s12.main-container {
|
||||
background: #FFF;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
#search {
|
||||
background: white;
|
||||
border: none;
|
||||
border-radius: 7px;
|
||||
height: 40px;
|
||||
width: 200px;
|
||||
transition: all 0.3s;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
#search:hover {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#search:focus {
|
||||
width: 500px;
|
||||
}
|
BIN
static/img/add-contacts.png
Normal file
BIN
static/img/add-contacts.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
static/img/favicon.ico
Normal file
BIN
static/img/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
static/img/logo.png
Normal file
BIN
static/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
@ -0,0 +1,74 @@
|
||||
let working = false;
|
||||
let lastQuery = null;
|
||||
|
||||
let displayContacts = (contacts) => {
|
||||
let tbody = $("table tbody");
|
||||
|
||||
for (let contact of contacts) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td>${(contact["first_name"] ? contact["first_name"] : (contact["firstName"] ? contact["firstName"] : ""))}</td>
|
||||
<td>${(contact["last_name"] ? contact["last_name"] : (contact["lastName"] ? contact["lastName"] : ""))}</td>
|
||||
<td>${(contact["surname"] ? contact["surname"] : "")}</td>
|
||||
<td>${(contact["email"] ? contact["email"] : "")}</td>
|
||||
<td>${(contact["address"] ? contact["address"] : "")}</td>
|
||||
<td>${(contact["phone_number"] ? contact["phone_number"] : (contact["phoneNumber"] ? contact["phoneNumber"] : ""))}</td>
|
||||
<td>${(contact["birthday"] ? new Date(contact["birthday"]).toLocaleDateString() : "")}</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
let modal = $('.modal');
|
||||
|
||||
modal.modal();
|
||||
|
||||
let search = (query) => {
|
||||
if (query.length >= 3) {
|
||||
working = true;
|
||||
$.ajax({
|
||||
url: "/api/contact/search",
|
||||
method: "POST",
|
||||
data: {
|
||||
query: query
|
||||
},
|
||||
success: function (data) {
|
||||
$("table tbody").empty();
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (data && data.result && data.result[i.toString()] && data.result[i.toString()].length > 0) {
|
||||
displayContacts(data.result[i.toString()]);
|
||||
}
|
||||
}
|
||||
|
||||
working = false;
|
||||
},
|
||||
error: function (e) {
|
||||
working = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("table tbody").empty();
|
||||
displayContacts(contacts);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on("input", "#search", () => {
|
||||
let query = $("#search").val();
|
||||
|
||||
if (!working) {
|
||||
search(query);
|
||||
} else {
|
||||
lastQuery = query;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", ".add-contacts", () => {
|
||||
modal.open();
|
||||
});
|
||||
|
||||
$("[data-tooltip]").tooltip();
|
||||
|
||||
});
|
||||
|
4
static/js/jquery-3.2.1.min.js
vendored
4
static/js/jquery-3.2.1.min.js
vendored
File diff suppressed because one or more lines are too long
2
static/js/jquery-3.3.1.min.js
vendored
Normal file
2
static/js/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
static/js/materialize.min.js
vendored
Normal file
6
static/js/materialize.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user