1
I created an if/elseif condition inside the foreache, to change the color of the pay status button. I have three status and are three colors for home status. Only he’s not getting the colors. I think the problem is time to select the values for the variable. I’ll send a print of my screen.
<?php
$query = $this->sindico->get_listfinanceiro()->result();
foreach ($query as $linha):
echo '<tr>';
printf('<td>%s / %s</td>', ($linha->numero_apart) ? :'/', ($linha->nome_usu));
printf('<td>%s</td>', $linha->data_pagamento);
printf('<td>%s</td>', "Bs:".$linha->valor_pagamento);
$class = "" ;
if (!isset($linha->valor_pagamento["PAGO"])){
$class = 'btn-sucesso' ;}
elseif (!isset($linha->valor_pagamento["PENDENTE"])){
$class = 'btn-warning' ;}
elseif (!isset($linha->valor_pagamento['NO PAGO'])){
$class = 'btn-danger' ;}
printf('<td><button type="button" class="btn '.$class.' btn-xs">%s</button></td>', $linha->status_pagamento);
printf('<td class="text-center">%s</td>', '<div class="btn-group btn-xs"><button data-toggle="dropdown" class="btn btn-xs dropdown-toggle" data-original-title="" title="">Action<span class="caret"></span></button><ul class="dropdown-menu pull-right"><li><a href="editar/'.$linha->id_finan.'">Edit</a></li><li><a href="excluir/'.$linha->id_finan.'">Delete</a></li>' );
echo '</tr>';
endforeach;
?>
If you are using bootstrap then the correct class is btn-Success. Check to see if you’re really getting into if ?
– fernandoandrade