Commit b43cc511 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen

delete product when added to cart

parent c9d15988
......@@ -24,7 +24,7 @@ var makeRequest = function (value) {
data.polygonList.forEach(function (polygon) {
// '<li onclick="drawPolygon(this)" id="'+ polygon.id +'" class="pol">' + polygon.city + ", " + polygon.state + '</li>'
var html_element = '<li id="'+ polygon.id +'" onclick="drawPolygon(this)" class="pol">' +
var html_element = '<li id="'+ polygon.id +'" onclick="drawPolygon(this)" class="pol">' +
'<div class="box box-warning box-solid">'+
'<div class="box-header with-border">'+
'<span class="pol-title">'+
......@@ -40,7 +40,7 @@ var makeRequest = function (value) {
'</div>'+
'</div>'+
'</div>'+
'</li>';
'</li>';
$('#polygon-list').append(html_element);
});
......@@ -92,12 +92,17 @@ $("#id_polygon").on('keyup', function (e) {
});
function erase_product_list_globe() {
var pol_element = document.getElementById('product-list-globe');
while (pol_element.firstChild) {
var pol_element = document.getElementById('product-list-globe');
while (pol_element.firstChild) {
pol_element.removeChild(pol_element.firstChild);
}
}
function erase_product_list_globe_by_id(element_id) {
var $li_element = $('li#' + element_id);
$li_element[0].parentNode.removeChild($li_element[0]);
}
var prevfeature = null;
function drawApiResponse(element) {
product_list.catalog.forEach(function (data) {
......@@ -274,7 +279,7 @@ $(document).ready(function () {
event.preventDefault();
erase_product_list_globe();
// erase_product_list_globe();
console.log("Submitted data:", typeof(submit_data));
console.log("Submitted data:", submit_data);
......@@ -301,6 +306,7 @@ $(document).ready(function () {
if (submit_data_array.indexOf(data.id) > -1) {
console.log("DATA sí esta: ", data.id);
console.log("SS: ", data.product.size);
erase_product_list_globe_by_id(data.id);
product_html_li += '<li id="' + data.id + '">' +
'<a href="javascript:void(0)">' +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment