Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
224 lines (213 loc) Β· 8.46 KB
/
Copy pathindex.html
File metadata and controls
224 lines (213 loc) Β· 8.46 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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library Manager - Connected to C# API</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<!-- Header -->
<header>
<h1>Library Manager</h1>
<p class="subtitle">Connected to C# API</p>
<div id="connectionStatus" class="connection-status">
<span class="status-dot"></span>
<span class="status-text">Checking connection...</span>
</div>
</header>
<!-- Add Book Form Section -->
<section class="card add-book-section">
<h2>Add New Book</h2>
<form id="addBookForm">
<div class="form-row">
<div class="form-group">
<label for="title">Title:</label>
<input
type="text"
id="title"
name="title"
placeholder="Enter book title"
required
minlength="1"
maxlength="200"
>
<span class="error-message" id="titleError"></span>
</div>
<div class="form-group">
<label for="author">Author:</label>
<input
type="text"
id="author"
name="author"
placeholder="Enter author name"
required
minlength="1"
maxlength="100"
>
<span class="error-message" id="authorError"></span>
</div>
<div class="form-group">
<label for="pageCount">Pages:</label>
<input
type="number"
id="pageCount"
name="pageCount"
placeholder="100"
required
min="1"
max="10000"
>
<span class="error-message" id="pageCountError"></span>
</div>
</div>
<button type="submit" id="addButton" class="btn btn-primary">
<span class="button-text">Add Book</span>
<span class="spinner hidden"></span>
</button>
</form>
</section>
<!-- Search Section -->
<section class="card search-section">
<div class="search-box">
<label for="searchInput">Search Books:</label>
<input
type="text"
id="searchInput"
placeholder="Search by title or author..."
>
</div>
<div class="filter-options">
<label>
<input type="radio" name="filter" value="all" checked> All
</label>
<label>
<input type="radio" name="filter" value="available"> Available
</label>
<label>
<input type="radio" name="filter" value="checked-out"> Checked Out
</label>
</div>
</section>
<!-- Books Display Section -->
<section class="books-section">
<div class="section-header">
<h2>All Books</h2>
<button onclick="loadBooks()" class="btn btn-secondary btn-small">
Refresh
</button>
</div>
<!-- Loading State -->
<div id="loading" class="loading-state">
<div class="spinner-large"></div>
<p>Loading books from API...</p>
</div>
<!-- Error State -->
<div id="error" class="error-state hidden">
<div class="error-icon">!</div>
<h3>Connection Error</h3>
<p id="errorMessage">Unable to connect to the API.</p>
<div class="error-help">
<p><strong>Troubleshooting tips:</strong></p>
<ul>
<li>Make sure your C# API is running (dotnet run)</li>
<li>Check if the API URL is correct in app.js</li>
<li>Verify CORS is enabled in Program.cs</li>
</ul>
</div>
<button onclick="loadBooks()" class="btn btn-primary">Try Again</button>
</div>
<!-- Empty State -->
<div id="emptyState" class="empty-state hidden">
<div class="empty-icon">EMPTY</div>
<h3>No Books Found</h3>
<p>Your library is empty. Add your first book above!</p>
</div>
<!-- Books Grid -->
<div id="booksList" class="books-grid hidden"></div>
</section>
</div>
<!-- Edit Modal -->
<div id="editModal" class="modal hidden">
<div class="modal-overlay" onclick="closeModal()"></div>
<div class="modal-content">
<div class="modal-header">
<h2>Edit Book</h2>
<button class="modal-close" onclick="closeModal()">×</button>
</div>
<form id="editBookForm">
<input type="hidden" id="editBookId">
<div class="form-group">
<label for="editTitle">Title:</label>
<input
type="text"
id="editTitle"
required
minlength="1"
maxlength="200"
>
</div>
<div class="form-group">
<label for="editAuthor">Author:</label>
<input
type="text"
id="editAuthor"
required
minlength="1"
maxlength="100"
>
</div>
<div class="form-group">
<label for="editPageCount">Pages:</label>
<input
type="number"
id="editPageCount"
required
min="1"
max="10000"
>
</div>
<div class="modal-buttons">
<button type="button" class="btn btn-secondary" onclick="closeModal()">
Cancel
</button>
<button type="submit" class="btn btn-primary">
<span class="button-text">Save Changes</span>
<span class="spinner hidden"></span>
</button>
</div>
</form>
</div>
</div>
<!-- Delete Confirmation Modal -->
<div id="deleteModal" class="modal hidden">
<div class="modal-overlay" onclick="closeDeleteModal()"></div>
<div class="modal-content modal-small">
<div class="modal-header">
<h2>Delete Book</h2>
<button class="modal-close" onclick="closeDeleteModal()">×</button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete "<span id="deleteBookTitle"></span>"?</p>
<p class="warning-text">This action cannot be undone.</p>
</div>
<div class="modal-buttons">
<button type="button" class="btn btn-secondary" onclick="closeDeleteModal()">
Cancel
</button>
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">
<span class="button-text">Delete</span>
<span class="spinner hidden"></span>
</button>
</div>
</div>
</div>
<!-- Toast Notification -->
<div id="toast" class="toast hidden">
<span class="toast-icon"></span>
<span class="toast-message"></span>
</div>
<script src="app.js"></script>
</body>
</html>