<table class="list" id="massage">
<button type="button" style="width: 90px; height: 90px" class="btn btn-xs btn-danger" onclick="Status(this)" >
<i class="fa fa-minus-circle" style="font-size: 50px"></i>
<input type="hidden" name="product_id[]" value="<?php echo $product['product_id']?>">
</button>
function Status(element){
var row = $(element).closest("td");
var product_id = row.find("input[name='product_id[]']").val();
$.ajax({
type: 'POST',
url: 'index.php?route=catalog/filterProvider/status&token=<?php echo $token; ?>',
data:{
"product_id":product_id
},
success: function (data) {
$('#status').html(data);
}
});
var id = element.parentNode.parentNode.rowIndex;
document.getElementById('massage').deleteRow(id);
}
метод deleteRow
удаляет строку с таблице, а есть такой метод что бы менял цвет ?
<form action="" method="post" enctype="multipart/form-data" id="form">
<table class="list" id="massage">
<thead>
<tr>
<td class="center"><?php echo $text_image; ?></td>
<td><?php echo $text_status; ?></td>
<td><?php echo $text_brand; ?></td>
<td><?php echo $text_provider; ?></td>
<td><?php echo $text_quantity; ?></td>
<td class="center"><?php echo $column_action; ?></td>
</tr>
</thead>
<tbody>
<tr class="filter">
<td></td>
<td>
<select name="filter_stock_status">
<option value="*"><?php echo $text_all_status; ?></option>
<?php foreach ($stock_status as $status) { ?>
<?php if ($status['stock_status_id'] == $filter_stock_status) { ?>
<option value="<?php echo $status['stock_status_id']; ?>" selected="selected"><?php echo $status['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $status['stock_status_id']; ?>"><?php echo $status['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
</td>
<td>
<select name="filter_manufacturer">
<option value="*"><?php echo $text_all_status; ?></option>
<?php foreach ($manufacturers as $manufacturer) { ?>
<?php if ($manufacturer['manufacturer_id'] == $filter_manufacturer) { ?>
<option value="<?php echo $manufacturer['manufacturer_id']; ?>" selected="selected"><?php echo $manufacturer['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $manufacturer['manufacturer_id']; ?>"><?php echo $manufacturer['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
</td>
<td>
<select name="filter_provider">
<option value="*"><?php echo $text_all_status; ?></option>
<?php foreach ($providers as $provider) { ?>
<?php if ($provider['code'] == $filter_provider) { ?>
<option value="<?php echo $provider['code']; ?>" selected="selected"><?php echo $provider['code']; ?></option>
<?php } else { ?>
<option value="<?php echo $provider['code']; ?>"><?php echo $provider['code']; ?></option>
<?php } ?>
<?php } ?>
</select>
</td>
<td></td>
<td align="center"><a onclick="filter();" class="button"><?php echo $button_filter; ?></a></td>
</tr>
<?php if ($products) { ?>
<?php foreach ($products as $product) { ?>
<tr>
<td class="center">
<a href="<?php echo $product['popup']; ?>" title="<?php echo $product['name']; ?>" class="colorbox" rel="colorbox">
<img src="<?php echo $product['image']; ?>" alt="<?php echo $product['name']; ?>" style="padding: 1px; border: 1px solid #DDDDDD;" id="thumb-<?php echo $product['product_id'];?>"/>
</a>
</td>
<td class="center">
<?php if($product['status'] != 7) { ?>
<button type="button" style="width: 90px; height: 90px" class="btn btn-xs btn-danger" onclick="Status(this)" >
<i class="fa fa-minus-circle" style="font-size: 50px"></i>
<input type="hidden" name="product_id[]" value="<?php echo $product['product_id']?>">
</button>
<?php }else{ ?>
<button type="button" style="width: 90px; height: 90px" class="btn btn-xs btn-success" >
<i class="fa fa-minus-circle" style="font-size: 50px"></i>
<input type="hidden" name="product_id[]" value="<?php echo $product['product_id']?>">
</button>
<?php } ?>
</td>
<td><?php echo $product['name']?></td>
<td>
<?php foreach($product['provider'] as $provider){ ?>
<?php echo $provider['code'] . '<br>'; ?>
<?php } ?>
</td>
<td class="right"><?php if ($product['quantity'] <= 0) { ?>
<span style="color: #FF0000;"><?php echo $product['quantity']; ?></span>
<?php } elseif ($product['quantity'] <= 5) { ?>
<span style="color: #FFA500;"><?php echo $product['quantity']; ?></span>
<?php } else { ?>
<span style="color: #008000;"><?php echo $product['quantity']; ?></span>
<?php } ?></td>
<td class="right"></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="center" colspan="8"><?php echo $text_no_results; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
function Status(element){
var row = $(element).closest("td");
var product_id = row.find("input[name='product_id[]']").val();
$.ajax({
type: 'POST',
url: 'index.php?route=catalog/filterProvider/status&token=<?php echo $token; ?>',
data:{
"product_id":product_id
},
success: function (data) {
$('#status').html(data);
}
});
var id = element.parentNode.parentNode.rowIndex;
document.querySelector('#massage tr:nth-child(' + id + ')').style.setProperty('background-color', 'red', '');
//document.getElementById('massage').deleteRow(id);
}
JavaScript:
document.querySelector('#massage tr:nth-child(' + id + ')').style.setProperty('background-color', 'red', '');
JQuery:
$('#massage tr:nth-child(' + id + ')').css({
backgroundColor: '#F00'
});
Современные решения для бизнеса: как облачные и виртуальные технологии меняют рынок
Виртуальный выделенный сервер (VDS) становится отличным выбором
Использую библиотеку FileSaverjs для сохранения данных в файл
Мне нужно что бы в service worker вызывались NotificationsСоответственно мне нужно проверить пермишены
прошу вашей помощи, в mysql совсем новичокесть две таблицы student с полями id_st, id_gr1, name и group с полями id_gr, name_gr