Repository navigation
Expand file tree
/
Copy pathpago.php
More file actions
252 lines (214 loc) · 11.2 KB
/
Copy pathpago.php
File metadata and controls
252 lines (214 loc) · 11.2 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
<?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/sweetalert.min.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="detailt-list-cart">
<div class="container">
<div class="card p-3">
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12 col-12 mb-2">
<div class="d-flex align-items-lg-center h-100">
<h3 class="text-danger">Finalizar Compra - <small>Ingrese los datos requeridos.</small>
</h3>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 col-12 mb-2">
<div class="d-flex align-items-lg-center justify-content-end h-100">
<button id="btnRegistrar" class="button-red"><i class="fa fa-save"></i> Registrar</button>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12 col-12">
<div class="bs-component">
<div class="card mb-2">
<h4 class="card-header">Información del Cliente</h4>
<div class="card-body">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
<div class="form-group">
<label>N° de Documento</label>
<div class="input-group">
<input id="txtDocumento" class="form-control" type="text" placeholder="DNI, RUC, OTRO">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
<div class="form-group">
<label>Apellidos y Nombre o Razón Social</label>
<div class="input-group">
<input id="txtInformacion" class="form-control" type="text" placeholder="Ingrese información">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
<div class="form-group">
<label>N° de Celular</label>
<div class="input-group">
<input id="txtCelular" class="form-control" type="text" placeholder="Numero de Celular">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
<div class="form-group">
<label>Correo Electrónico</label>
<div class="input-group">
<input id="txtEmail" class="form-control" type="text" placeholder="Numero de Celular">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
<div class="form-group">
<label>Dirección</label>
<div class="input-group">
<input id="txtDireccion" class="form-control" type="text" placeholder="Ingrese su dirección">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 col-12">
<div class="bs-component">
<div class="card mb-2">
<h4 class="card-header">Resumen de la compra</h4>
<div class="card-body">
<h4 class="card-title">Cantidad de Productos</h4>
<p class="text-muted" id="lblCantidadTotal">0</p>
<h4 class="card-title">Importe Total</h4>
<p class="text-muted" id="lblImporteTotal">0.00</p>
</div>
</div>
</div>
</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/plugins/sweetalert.min.js"></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();
$(document).ready(function() {
cardStorage.renderCard();
$("#btnRegistrar").click(function() {
registrarCompra();
});
tools.keyEnter($("#btnRegistrar"), function(event) {
registrarCompra();
});
loadComponents();
$('#preloader').fadeOut(1000, function() {
$(this).remove();
});
});
function loadComponents() {
$("#lblCantidadTotal").html(cardStorage.getList().length);
let importe = 0;
for (let value of cardStorage.getList()) {
importe += value.cantidad * value.precio;
}
$("#lblImporteTotal").html("S/ " + tools.formatMoney(importe));
}
function registrarCompra() {
if (!tools.isText($("#txtDocumento").val())) {
tools.AlertWarning("", "Ingrese su n° de documento.");
$("#txtDocumento").focus();
} else if (!tools.isText($("#txtInformacion").val())) {
tools.AlertWarning("", "Ingrese su información.");
$("#txtInformacion").focus();
} else if (!tools.isText($("#txtCelular").val())) {
tools.AlertWarning("", "Ingrese su n° de celular");
$("#txtCelular").focus();
} else if (!tools.validateEmail($("#txtEmail").val())) {
tools.AlertWarning("", "Ingrese un correo electrónico valido.");
$("#txtEmail").focus();
} else if (cardStorage.getList().length == 0) {
tools.AlertWarning("", "Noy productos en el carrito para continuar.");
} else {
tools.ModalDialog("Pedido", '¿Está seguro de registra el pedido?', async function(value) {
if (value == true) {
try {
let detalle = cardStorage.getList().map(function(item, index) {
return {
"IdSuministro": item.idSuministro,
"Cantidad": item.cantidad,
"Precio": item.precio,
"Descuento": 0
};
});
let result = await tools.promiseFetchPost("./app/controller/PedidoController.php", {
"type": "webpedido",
"Documento": $("#txtDocumento").val().trim(),
"Informacion": $("#txtInformacion").val().trim(),
"Celular": $("#txtCelular").val().trim(),
"Email": $("#txtEmail").val().trim(),
"Direccion": $("#txtDireccion").val().trim(),
"Detalle": detalle
}, function() {
tools.ModalAlertInfo("Pedido", "Procesando petición..");
});
tools.ModalAlertSuccess("Pedido", result, function() {
cardStorage.empty();
window.open("./", "_self");
});
} catch (error) {
tools.ErrorMessageServer("Pedido", error);
}
}
});
}
}
</script>
</body>
</html>