-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetail.php
More file actions
61 lines (57 loc) · 2.85 KB
/
detail.php
File metadata and controls
61 lines (57 loc) · 2.85 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
<?php
$id = $_GET['id'];
$url = 'http://localhost:3333/hotels/' . $id;
$data = json_decode(file_get_contents($url), true);
?>
<?php include('./head.php') ?>
<body>
<?php include('./header.php') ?>
<main>
<div id="modal__success" onclick="invisibleModal()">
<div class="modal__success-content">
<div class="circle"> <img src="./img/success.svg" alt="" width="20px"></div>
<p id="modal__success-thanks">Obrigado! </p>
<p> Reserva realizada com sucesso</p>
</div>
</div>
<?php include('./form.php') ?>
<div class="cards__hotel">
<div class="card-info">
<img id="card-hotel" src="<?php echo $data['hotel']['image'] ?>" alt="<?php echo $data['hotel']['name'] ?>">
<div class="card-text">
<p id="card-name"><?php echo $data['hotel']['name'] ?></p>
<p id="card-address"><img src="./img/address.svg" alt="icon_address" width="12px"><?php echo $data['hotel']['address'] ?></p>
<?php for ($i = 0; $i < $data['hotel']['stars']; $i++) {
echo "<img id='card-rooms-star' src='./img/star.svg' alt='icon_true' width='20px'>";
} ?>
<p id="card-description"><?php echo $data['hotel']['description'] ?></p>
</div>
</div>
<?php
foreach ($data['rooms'] as $room) {
$div = "<div id='card-rooms'>";
$divRight = "<div id='card-rooms-right'>";
$divLeft = "<div id='card-rooms-left'>";
$IconTrue = "<img id='true' src='./img/comcancelamento.svg' alt='icon_true' width='12px'>";
$IconFalse = "<img id='false' src='./img/semcancelamento.svg' alt='icon_false' width='12px'>";
$buttonReserve = '<button id="button-reserve" type="button" onclick="visiblemodal()">Reservar Agora</button>';
$roomType = $room['roomType']['name'];
$amount = $room['price']['amount'];
$cancelation = $room['cancellationPolicies']['refundable'] == 1 ? $IconTrue . "<span id='true'>Cancelamento gratuito</span>" : $IconFalse . "<span id='false'>Multa de cancelamento</span>";
echo $div;
echo $divRight;
echo "<p id='card-rooms-tipe'>$roomType</p>";
echo "<p>$cancelation</p>";
echo '</div>';
echo $divLeft;
echo "<div>R$ $amount <span id='noite'>/noite</span><p id='pagamento'>Pagamento no hotel</p> </div>";
echo $buttonReserve;
echo '</div>';
echo '</div>';
}
?>
</div>
</main>
<?php include('./footer.php') ?>
</body>
<script type="text/javascript" src="./js/createModal.js"></script>