-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.html
More file actions
142 lines (129 loc) · 4.91 KB
/
contact.html
File metadata and controls
142 lines (129 loc) · 4.91 KB
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contacts Page</title>
<script type="text/javascript" src="js/code.js"></script>
<link href="css/contact.css" rel="stylesheet">
<link href="css/sidenav.css" rel="stylesheet">
<link href="css/addContact.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function()
{
readCookie();
searchContact(); // This will populate tbody when the page loads
// Modal popup logic for add-btn
const addBtn = document.getElementById("addButton");
const modal = document.getElementById("addContactModal");
const closeModal = document.getElementById("closeModal");
if (addBtn) {
addBtn.onclick = function() {
document.getElementById("addContactModal").style.display = "block";
document.getElementById("firstName").value = "";
document.getElementById("lastName").value = "";
document.getElementById("phone").value = "";
document.getElementById("email").value = "";
document.querySelector("#addContactModal h2").textContent = "Add Contact";
document.getElementById("addContactButton").textContent = "Add Contact";
document.getElementById("addContactButton").onclick = addContact;
};
}
if (addBtn && modal && closeModal) {
addBtn.onclick = function() {
modal.style.display = "block";
};
closeModal.onclick = function() {
modal.style.display = "none";
document.getElementById("firstName").value = "";
document.getElementById("lastName").value = "";
document.getElementById("phone").value = "";
document.getElementById("email").value = "";
document.querySelector("#addContactModal h2").textContent = "Add Contact";
document.getElementById("addContactButton").textContent = "Add Contact";
document.getElementById("addContactButton").onclick = addContact;
};
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
};
}
}, false);
</script>
</head>
<body>
<h1 id="title">Add or Search for a Contact!</h1>
<div class="sidenav">
<img id="logo" src="images/logo.png" alt="Logo image">
<div class="button-container">
<button type="button" id="aboutMe" class="buttons" onclick="window.location.href = 'https://github.com/Kitk00/COP4331SmallProjectGroup26'"> About Me </button>
<button type="button" id="logoutButton" class="buttons" onclick="doLogout();"> Log Out </button>
</div>
</div>
<!-- <div id="loggedInDiv">
<span id="userName"></span><br />
</div> --->
<div id="mainContent">
<div id="accessUIDiv">
<br />
<input type="text" id="searchText" placeholder="Search Contacts"/>
<button type="button" id="searchContactButton" class="icon-btn" onclick="searchContact();">🔍</button>
<br />
<div id="resultContainer">
<span id="contactSearchResult"></span>
<span id="contactAddResult"></span>
<span id="contactEditResult"></span>
<span id="contactDeleteResult"></span>
</div>
<p id="contactList">
</p>
<div class="tables">
<button id="addButton" class="add-btn">+</button>
<div class="table-content" id="contactTable">
<table id="contacts" cellpadding="0" cellspacing="0" borders="0">
<thead>
<tr>
<th class="tableHeader">First </th>
<th class="tableHeader">Last </th>
<th class="tableHeader">Email</th>
<th class="tableHeader">Phone</th>
<th class="tableHeader buttonCells">Edit/Delete</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
<div id="addContactModal" class="modal">
<div class="modal-content">
<span id="closeModal" class="close">×</span>
<h2 type="text" id="title">Add Contact</h2>
<span id="contactAddResult"></span>
<!-- You can add form fields here if needed -->
<form id="addContactForm">
<input type="text" id="firstName" placeholder="First Name" /><br />
<input type="text" id="lastName" placeholder="Last Name" /><br />
<input type="text" id="phone" placeholder="Phone" /><br />
<input type="text" id="email" placeholder="Email"/><br />
<div id="modalButtonContainer">
<button type="button" id="addContactButton" class="buttons" onclick="addContact();"> Add Contact </button><br />
</div>
</form>
</div>
</div>
<div id="deleteConfirmModal" class="modal">
<div class="modal-content">
<span id="closeDeleteModal" class="close">×</span>
<h2 type="text" id="title">Delete Contact</h2>
<div id="deleteMessage">Are you sure you want to delete this contact?</div>
<div id="modalDeleteButtonContainer">
<button id="confirmDeleteButton" class="buttons">Yes, Delete</button>
<button id="cancelDeleteButton" class="buttons">Cancel</button>
</div>
</div>
</div>
</body>
</html>