init
This commit is contained in:
4
views/create.ejs
Normal file
4
views/create.ejs
Normal file
@@ -0,0 +1,4 @@
|
||||
<form action="/customers" method="post">
|
||||
<%- include('form', { customer: {} }) %>
|
||||
<button class="btn btn-success">Zapisz</button>
|
||||
</form>
|
||||
4
views/edit.ejs
Normal file
4
views/edit.ejs
Normal file
@@ -0,0 +1,4 @@
|
||||
<form action="/customers/<%= customer.id %>?_method=PUT" method="post">
|
||||
<%- include('form', { customer }) %>
|
||||
<button class="btn btn-primary">Aktualizuj</button>
|
||||
</form>
|
||||
12
views/example.ejs
Normal file
12
views/example.ejs
Normal file
@@ -0,0 +1,12 @@
|
||||
<!-- views/przyklad.ejs -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%= title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><%= title %></h1>
|
||||
<p>Liczba: <%= liczba %></p>
|
||||
</body>
|
||||
</html>
|
||||
28
views/form.ejs
Normal file
28
views/form.ejs
Normal file
@@ -0,0 +1,28 @@
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Imię</label>
|
||||
<input type="text" name="firstName" class="form-control" value="<%= customer.firstName || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nazwisko</label>
|
||||
<input type="text" name="lastName" class="form-control" value="<%= customer.lastName || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Adres</label>
|
||||
<input type="text" name="address" class="form-control" value="<%= customer.address || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Kod pocztowy</label>
|
||||
<input type="text" name="postalCode" class="form-control" value="<%= customer.postalCode || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Miasto</label>
|
||||
<input type="text" name="city" class="form-control" value="<%= customer.city || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Telefon</label>
|
||||
<input type="text" name="phone" class="form-control" value="<%= customer.phone || '' %>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">NIP</label>
|
||||
<input type="text" name="nip" class="form-control" value="<%= customer.nip || '' %>" required>
|
||||
</div>
|
||||
29
views/index.ejs
Normal file
29
views/index.ejs
Normal file
@@ -0,0 +1,29 @@
|
||||
<a href="/customers/new" class="btn btn-primary mb-3">Dodaj klienta</a>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Imię</th>
|
||||
<th>Nazwisko</th>
|
||||
<th>Miasto</th>
|
||||
<th>Telefon</th>
|
||||
<th>Akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% customers.forEach(c => { %>
|
||||
<tr>
|
||||
<td><%= c.firstName %></td>
|
||||
<td><%= c.lastName %></td>
|
||||
<td><%= c.city %></td>
|
||||
<td><%= c.phone %></td>
|
||||
<td>
|
||||
<a href="/customers/<%= c.id %>" class="btn btn-sm btn-info">Pokaż</a>
|
||||
<a href="/customers/<%= c.id %>/edit" class="btn btn-sm btn-warning">Edytuj</a>
|
||||
<form action="/customers/<%= c.id %>?_method=DELETE" method="post" style="display:inline">
|
||||
<button class="btn btn-sm btn-danger" onclick="return confirm('Usunąć?')">Usuń</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<% }) %>
|
||||
</tbody>
|
||||
</table>
|
||||
15
views/layout.ejs
Normal file
15
views/layout.ejs
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lista klientów</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
</head>
|
||||
<body class="p-3">
|
||||
<div class="container">
|
||||
<h1 class="mb-4">Lista klientów</h1>
|
||||
<%- body %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
10
views/show.ejs
Normal file
10
views/show.ejs
Normal file
@@ -0,0 +1,10 @@
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><strong>Imię:</strong> <%= customer.firstName %></li>
|
||||
<li class="list-group-item"><strong>Nazwisko:</strong> <%= customer.lastName %></li>
|
||||
<li class="list-group-item"><strong>Adres:</strong> <%= customer.address %></li>
|
||||
<li class="list-group-item"><strong>Kod pocztowy:</strong> <%= customer.postalCode %></li>
|
||||
<li class="list-group-item"><strong>Miasto:</strong> <%= customer.city %></li>
|
||||
<li class="list-group-item"><strong>Telefon:</strong> <%= customer.phone %></li>
|
||||
<li class="list-group-item"><strong>NIP:</strong> <%= customer.nip %></li>
|
||||
</ul>
|
||||
<a href="/customers" class="btn btn-link mt-3">Powrót</a>
|
||||
21
views/users.ejs
Normal file
21
views/users.ejs
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Użytkownicy</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Lista użytkowników</h1>
|
||||
<ul>
|
||||
<% users.forEach(function(user) { %>
|
||||
<li><%= user.id %>: <%= user.name %></li>
|
||||
<% }) %>
|
||||
</ul>
|
||||
|
||||
<% if (config.showEmails) { %>
|
||||
<p>Adresy e-mail są widoczne</p>
|
||||
<% } else { %>
|
||||
<p>Adresy e-mail ukryte (strona <%= config.page %>)</p>
|
||||
<% } %>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user