Repository navigation
Expand file tree
/
Copy pathproducto.php
More file actions
310 lines (254 loc) · 12.8 KB
/
Copy pathproducto.php
File metadata and controls
310 lines (254 loc) · 12.8 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<?php
use SysSoftIntegra\Model\EmpresaADO;
require __DIR__ . '/app/src/autoload.php';
$empresa = EmpresaADO::Index();
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta name="description"
content="Importaciones Leonardo - LeatSact encuentre de todo para su vehículo en un solo lugar.">
<meta name="language" content="es-PE">
<meta name="country" content="PER">
<meta name="currency" content="S/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="./resource/images/icono.png">
<title><?= $empresa->NombreComercial ?></title>
<link rel="shortcut icon" href="#" />
<link rel="stylesheet" type="text/css" href="view/css/main.css?v=<?php echo (rand()); ?>">
<link rel="stylesheet" type="text/css" href="view/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="view/css/shop.css?v=<?php echo (rand()); ?>">
<link rel="stylesheet" type="text/css" href="view/css/catalogo.css?v=<?php echo (rand()); ?>">
</head>
<body>
<div id="preloader">
</div>
<?php include './header.php'; ?>
<div class="public-content">
<div class="container">
<div class="image">
<a href="#">
<img src="./resource/images/banner.jpeg">
</a>
</div>
</div>
</div>
<section class="product-content">
<div class="container">
<div class="card p-5">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
<div class="product-image">
<div class="image" id="lblImage">
<img src="./resource/images/noimage.png">
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
<div class="product-details">
<h2 class="product-name" id="lblName"></h2>
<div>
<div class="product-rating">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-o"></i>
</div>
</div>
<div>
<h3 class="product-price" id="lblNewPrice">0.00 <del class="product-old-price"
id="lblOldPrice">0.00</del></h3>
<span class="product-available">En Stock</span>
</div>
<p id="txtDescripcion" class="text-uppercase"></p>
<div class="row pb-3">
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12">
<span><strong>Categoria:</strong></span>
</div>
<div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-12">
<span class="text-muted font-italic" id="lblCategoria"></span>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12">
<span><strong>Marca:</strong></span>
</div>
<div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-12">
<span class="text-muted font-italic" id="lblMarca"></span>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12">
<span><strong>Presentacion:</strong></span>
</div>
<div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-12">
<p class="text-muted font-italic" id="lblPresentacion"></p>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12">
<span><strong>Unidad:</strong></span>
</div>
<div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-12">
<p class="text-muted font-italic" id="lblUnidad"></p>
</div>
</div>
<!-- <h6 class="text-muted" id="lblUnidad"></h6> -->
<div class="add-to-cart">
<div class="qty-label">
Cantidad
<div class="input-number">
<input type="text" id="txtCantidad" inputmode="numeric" value="1"
autocomplete="off" />
<span class="qty-up">+</span>
<span class="qty-down">-</span>
</div>
</div>
<button class="add-to-cart-btn" id="btnAddCard"><i class="fa fa-shopping-cart"></i>
Agregar</button>
</div>
<div class="csiFormatText">
<p>
<span class="csiGreenText">Envío a todo el Perú, puedes pagar con tus tarjetas
preferidas</span>
<strong>Visa Mastercard y Amex a través de PayPal</strong>
<br class="showInCart">
</p>
</div>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="tabset">
<input type="radio" name="tabset" id="tab1" aria-controls="marzen" checked>
<label for="tab1" class="label-tab">Descripción</label>
<input type="radio" name="tabset" id="tab2" aria-controls="rauchbier">
<label for="tab2" class="label-tab">Ficha Técnica</label>
<input type="radio" name="tabset" id="tab3" aria-controls="dunkles">
<label for="tab3" class="label-tab">Adjuntos</label>
<div class="tab-panels">
<section id="marzen" class="tab-panel">
<h2>Descripción</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem repellendus
recusandae accusamus eius sit, porro dolor deserunt sapiente nam ratione non
facere cum illum quaerat, accusantium optio asperiores, quo nesciunt?</p>
</section>
<section id="rauchbier" class="tab-panel">
<h2>Ficha Técnica</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem repellendus
recusandae accusamus eius sit, porro dolor deserunt sapiente nam ratione non
facere cum illum quaerat, accusantium optio asperiores, quo nesciunt?</p>
</section>
<section id="dunkles" class="tab-panel">
<h2>Adjuntos</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem repellendus
recusandae accusamus eius sit, porro dolor deserunt sapiente nam ratione non
facere cum illum quaerat, accusantium optio asperiores, quo nesciunt?</p>
</section>
</div>
</div>
</div>
</div>
<!-- <div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
</div>
</div> -->
</div>
</div>
</section>
<?php include './footer.php'; ?>
<script src="view/js/jquery-3.3.1.min.js"></script>
<script src="view/js/bootstrap.min.js"></script>
<script src="view/js/plugins/bootstrap-notify.min.js"></script>
<script src="view/js/main.js?v=<?php echo (rand()); ?>"></script>
<script src="view/js/tools.js?v=<?php echo (rand()); ?>"></script>
<script src="resource/storage/cardStorage.js?v=<?php echo (rand()); ?>"></script>
<script>
let tools = new Tools();
let cardStorage = new CardStorage();
let name_product = "<?= (isset($_GET["name"]) ? $_GET["name"] : null) ?>";
let idSuministro = "";
let precio = 0;
$(document).ready(function() {
if (name_product == "") {
history.back()
return;
}
cardStorage.renderCard();
$(".qty-up").click(function() {
let cantidad = tools.isNumeric($("#txtCantidad").val()) ? parseInt($("#txtCantidad")
.val()) : 1;
cantidad = cantidad <= 0 ? 0 : cantidad;
cantidad++;
$("#txtCantidad").val(cantidad);
});
$(".qty-down").click(function() {
let cantidad = tools.isNumeric($("#txtCantidad").val()) ? parseInt($("#txtCantidad")
.val()) : 1;
if (cantidad <= 1) {
return;
}
cantidad--;
$("#txtCantidad").val(cantidad);
});
tools.keyNumberInteger($("#txtCantidad"));
$("#txtCantidad").focusout(function() {
let cantidad = tools.isNumeric($("#txtCantidad").val()) ? parseInt($("#txtCantidad")
.val()) : 1;
cantidad = cantidad <= 0 ? 1 : cantidad;
$("#txtCantidad").val(cantidad);
});
$("#btnAddCard").click(function() {
addCard();
});
$("#btnAddCard").keypress(function(event) {
if (event.keyCode == 13) {
addCard();
event.preventDefault();
}
});
getProducto();
});
async function getProducto() {
try {
let result = await tools.promiseFetchGet("./app/controller/SuministroController.php", {
"type": "valueSuministro",
"value": name_product
});
idSuministro = result.IdSuministro;
precio = parseFloat(result.PrecioVentaGeneral);
$("#lblName").html(result.NombreMarca);
$("#lblNewPrice").html("S/ " + tools.formatMoney(result.PrecioVentaGeneral) +
' <del class="product-old-price" >S/ ' + tools.formatMoney(result.PrecioVentaAlto) + '</del>');
let image = '<img src ="./resource/images/noimage.png" alt="' + result.NombreMarca + '"/>';
if (result.Imagen != "") {
image = '<img class="img-size-70" src ="' + ("./resource/catalogo/" + result.Imagen) + '" alt="' +
result.NombreMarca + '"/>';
}
$("#lblImage").html(image);
$("#txtDescripcion").html(result.Descripcion);
$("#lblCategoria").html(result.CategoriaNombre);
$("#lblMarca").html(result.MarcaNombre);
$("#lblPresentacion").html(result.PresentacionNombre);
$("#lblUnidad").html(result.UnidadCompraNombre);
$('#preloader').fadeOut(1000, function() {
$(this).remove();
});
} catch (error) {
history.back()
return;
}
}
function addCard() {
cardStorage.add({
"idSuministro": idSuministro,
"cantidad": tools.isNumeric($("#txtCantidad").val()) ? parseInt($("#txtCantidad").val()) : 1,
"image": $("#lblImage").find("img")[0].src,
"nombre": $("#lblName").html(),
"precio": precio,
});
cardStorage.renderCard();
tools.AlertSuccess("", "Se agregó el producto.")
}
</script>
</body>
</html>