Фон работает, стоит на всех остальных страницах. Когда я захожу на эту страницу, у меня просто белый экран и текст. Я предполагаю, что проблема в том, что это происходит не на (/edit.hbs), а на edit / {{this.id}}. Но я не уверен. Пожалуйста, помогите мне разобраться.
dashboard.hbs:
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<head>
<title>database</title>
</head>
<body>
<div class="site-style">
<div class="fullscreen-bg">
<div class="main-log1"><span class="book_title"> Запланированые мероприятия </span> <br> <table class="table" border="1" width="100%" cellpadding="5">
<tr><th>Time</th><th>Day</th><th>Mounth</th><th>Year</th><th>Price</th><th>Duration</th><th>Halls_idHalls</th><th>Parties_idParties</th><th></th></tr>
{{#each booking}}
<tr>
<td>{{this.Time}}</td>
<td>{{this.Day}}</td>
<td>{{this.Mounth}}</td>
<td>{{this.Year}}</td>
<td>{{this.Price}}</td>
<td>{{this.Duration}}</td>
<td>{{this.Halls_idHalls}}</td>
<td>{{this.Parties_idParties}}</td>
<td>
<a href="/edit/{{this.id}}">Edit</a>|
<form action="delete/{{this.id}}" method="POST" style="display: inline;">
<input type="submit" value="Delete" />
</form>
</td>
</tr>
{{/each}}
</table>
</div>
<video loop muted autoplay poster="video/plane.jpg" class="fullscreen-bg__video" width="100%" height="auto" autoplay="autoplay" loop="loop" preload="auto">
<source src="club_v.mp4" type="video/mp4">
</video>
</div>
</body>
</html>
edit.hbs:
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<head>
<title>Редактирование пользователя</title>
</head>
<body>
<div class="fullscreen-bg">
<div class="main-log">
<span class="book_title"> Редактирование </span> <br>
<form action="/edit" method="POST">
<input type="hidden" name="id" value="{{booking.id}}" />
<label>Time</label><br>
<input name="time" type="number" value="{{booking.Time}}" class="field" /><br><br>
<label>Day</label><br>
<input name="day" type="number" value="{{booking.Day}}" class="field" /><br><br>
<label>Mounth</label><br>
<input name="name" type="number" value="{{booking.Mounth}}" class="field" /><br><br>
<label>Year</label><br>
<input name="name" type="number" value="{{booking.Year}}" class="field" /><br><br>
<label>Price</label><br>
<input name="name" type="number" value="{{booking.Price}}" class="field" /><br><br>
<label>Duration</label><br>
<input name="name" type="number" value="{{booking.Duration}}" class="field" /><br><br>
<label>Hall</label><br>
<input name="name" type="number" value="{{booking.Halls_idHalls}}" class="field" /><br><br>
<label>Party</label><br>
<input name="name" type="number" value="{{booking.Parties_idParties}}" class="field" /><br><br>
<input type="submit" value="Отправить" />
</form>
<a href="/dashboard">К списку пользователей</a>
</div>
<video loop muted autoplay poster="video/plane.jpg" class="fullscreen-bg__video" width="100%" height="auto" autoplay="autoplay" loop="loop" preload="auto">
<source src="club_v.mp4" type="video/mp4">
</video>
</div>
</body>
<html>
server.js:
...
const mysql = require("mysql2");
const urlencodedParser = bodyParser.urlencoded({extended: false});
const pool = mysql.createPool({
connectionLimit: 5,
host: "localhost",
user: "root",
database: "nightgl",
password: "1221"
});
app.set("view engine", "hbs");
app.get("/dashboard", function(req, res){
pool.query("SELECT * FROM booking", function(err, data) {
if(err) return console.log(err);
res.render("dashboard.hbs", {
booking: data
});
});
});
app.get("/edit/:id", function(req, res){
const id = req.params.idBooking;
pool.query("SELECT * FROM booking WHERE idBooking=?", [idBooking], function(err, data) {
if(err) return console.log(err);
res.render("edit.hbs", {
booking: data[0]
});
});
});
app.post("/edit", urlencodedParser, function (req, res) {
if(!req.body) return res.sendStatus(400);
const party = req.body.Parties_idParties;
const hall = req.body.Halls_idHalls;
const duration = req.body.Duration;
const price = req.body.Price;
const year = req.body.Year;
const mounth = req.body.Mounth;
const day = req.body.Day;
const time = req.body.Time;
const id = req.body.idBooking;
pool.query("UPDATE booking SET Parties_idParties=?, Halls_idHalls=? Duration=? Price=? Year=? Mounth=? Day=? Time=? WHERE idBooking=?", [Parties_idParties, Halls_idHalls, Duration, Price, Year, Mounth, Day, Time, idBooking], function(err, data) {
if(err) return console.log(err);
res.redirect("/dashboard");
});
});
...
style.css:
.site-main {
z-index: 0;
}
.btn {
-webkit-appearance: push-button;
font-size: 17px;
font-weight: bold;
font-family: Georgia;
text-transform: uppercase;
letter-spacing: 1.1px;
color: #33333;
user-select: none;
white-space: pre;
align-items: flex-start;
text-align: center;
cursor: default;
border-style: none;
background-color: #fe90de;
border-radius: 50px 50px 50px 50px;
padding: 15px 40px 15px 40px;
margin-left: 7px;
}
.fullscreen-bg {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
}
.fullscreen-bg__video {
position: absolute;
top: 0;
left: 0;
}
.main-log {
z-index: 2147483647;
position: absolute;
width: 340px;
height: 320px;
background: rgb(255, 255, 255, 0.86);
padding-left: 15px;
padding-top: 30px;
margin: 100px 40px 40px 200px;
font-size: 1.2em;
color: #000000;
font-family: Helvetica;
margin-left: 450px;
}
.main-log1 {
z-index: 2147483647;
position: absolute;
width: 1100px;
height: 550px;
background: rgb(255, 255, 255, 0.86);
padding: 10px;
margin: 50px 20px 40px 100px;
font-size: 1.8em;
color: #000000;
font-family: "comic sans ms", sans-serif;
overflow-x:hidden;
}
.main-log2 {
z-index: 2147483647;
position: absolute;
width: 340px;
height: 260px;
background: rgb(255, 255, 255, 0.86);
padding-left: 15px;
padding-top: 30px;
margin: 100px 40px 40px 200px;
margin-left: 450px;
}
.reg-text {
font-size: 17px;
font-weight: bold;
font-family: Georgia;
text-transform: uppercase;
letter-spacing: 1.1px;
color: #33333;
padding-left: 80px;
padding-bottom: 15px;
}
.book_title {
font-size: 1.5em;
color: #000000;
font-family: "comic sans ms", sans-serif;
padding-left: 20px;
padding-top: 100px;
}
.table {
border-collapse: collapse;
border: 1px solid grey;
font-size: 0.5em;
color: #DB3636;
font-family: Helvetica;
}
Состав: 1
Страница: 2