pretienda

This commit is contained in:
mynah
2019-04-04 19:45:51 -06:00
parent 49b1256e27
commit 567e991278
10 changed files with 256 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
<section class="shop">
<article class="heading"> <p class="heading">TIENDA VIRTUAL</p> </article>
% for (@$r){
<a href="/storep/<%= $_->{id} %>">
<article class="shop flex">
<div class="simage" > <img src=<%= "$controller/$action/img/$_->{imagen} "%> ></div>
<div class="description">
@@ -14,6 +15,7 @@
<p class="promo"> <%= $_->{promocion} %> </p>
</div>
</article>
</a>
<article class="separator"></article>
%}
</section>

60
templates/home/storep.html.ep Executable file
View File

@@ -0,0 +1,60 @@
<!--<head>-->
<!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge" />-->
<!--</head>-->
%stash css=>["/home/storep/storep.css"];
<section class="item"> <section class="transp flex">
<article class=iimage>
<img class="small" src= "/home/store/img/<%= $imagen %>">
</article>
<article class=iinfo>
<p class="txt"><%= $subnombre %></p>
<p class="txt"><%= $descripcion %></p>
<p class="promo"><%= $promocion %></p>
<p class="precio">Precio:$<%= $precio %> pesos</p>
<p class="existencia">
<% if ($existencia > 10) { =%> <p class="eok"></p> <% } =%>
<% elsif ($existencia >= 1) { =%> <p class="elow">¡Nos quedan pocos!</p> <% } =%>
<% elsif ($existencia == 0) { =%> <p class="eldep">¡Agotado!</p> <% } =%>
<div class=ppl>
<div id="paypal-button-container"></div>
</div>
</article>
</section> </section>
<section class="ibottom">
<p class="nombre"><%= $objeto %></p>
<p class="tit"><%= $nombre %></p>
</section>
<section class="bdat"> </section>
<script src="https://www.paypal.com/sdk/js?client-id=AQdZ1JJL-GNBgGTI3W6cXChmj6MnZsInRGlWeHw1kbGiE_49eTtZ2fPvEq9ersU2y6O5WpxccdsyAQw7&currency=MXN"></script>
<script>
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '0.18'
}
}]
}); },
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
return fetch('/tst', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
})
// .then(response=>response.json())
// .then(data => {alert(data)})
});
}
}).render('#paypal-button-container');
</script>

View File

@@ -5,11 +5,12 @@
%stash css=>["/home/tst/tst.css"];
<section class="item"> <section class="transp flex">
<article class=iimage>
<img class="small" src= "home/store/img/libro.jpg">
<img class="small" src= "/home/store/img/<%= $imagen %>">
</article>
<article class=iinfo>
<p class="txt"><%= $subnombre %></p>
<p class="txt"><%= $descripcion %></p>
<p class="promo"><%= $promo %></p>
<p class="promo"><%= $promocion %></p>
<p class="precio">Precio:$<%= $precio %> pesos</p>
<p class="existencia">
<% if ($existencia > 10) { =%> <p class="eok"></p> <% } =%>
@@ -21,8 +22,8 @@
</article>
</section> </section>
<section class="ibottom">
<p class="nombre"><%= $nombre %></p>
<p class="tit"><%= $titulo %></p>
<p class="nombre"><%= $objeto %></p>
<p class="tit"><%= $nombre %></p>
</section>
<section class="bdat"> </section>