⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Customization issue with JQuery



josemalcher

josemalcher
  • profile picture
  • Member

Posted 29 July 2019 - 18:10 PM

Hello
I'm posting for the first time, this forum has always helped me a lot!
 
Well, I have the following problem. View images!

 

I am using the following codes to change the state in the table:

 

[attachment=1371:duvida-1-grocery.PNG]

 

[attachment=1372:duvida-2-grocery.PNG]

```

if ($priority == 0) {
return '<span class="pedido_realizado" style="color:#60676a;"></span>';
}
if ($checkout_Y == -0001 && $checkin_Y == -0001) {
return '<span class="aguardando_checkin" style="color:#60676a;"></span>';
}
if($checkout_Y != -0001 && $checkin_Y != -0001){
return '<span class="completo_in_out" style="color:#60676a;"></span>';
}

 

```

 

```

$(document).ready(function () {
$('.completo_in_out').parent().parent().addClass( "success").find('a').addClass( "hidden" );
$('.pedido_realizado').parent().parent().addClass( "info" ).find('a').addClass( "hidden" );
$('.aguardando_checkin').parent().parent().addClass( "warning" );

});

 

```

Has anyone been through this situation ... or similar?
 
Need help!
 
Thank you!! Hugs to all!

 

 


josemalcher

josemalcher
  • profile picture
  • Member

Posted 30 July 2019 - 19:35 PM

The only solution I found so far was to change the file:
 
 

assets/grocery_crud/themes/bootstrap/views/list_tbody.php

<script>
    $(document).ready(function () {
        $('.completo_in_out').parent().parent().addClass( "success").find('a').addClass( "hidden" );
        $('.pedido_realizado').parent().parent().addClass( "info" ).find('a').addClass( "hidden" );
        $('.aguardando_checkin').parent().parent().addClass( "warning" );

        $('#clock').countdown('2019/07/30 20:30:00', function(event) {
            $(this).html(event.strftime('%D dias e %H:%M:%S'));
        });
    });
</script>
 
But... in console chrome:
 
Uncaught ReferenceError: $ is not defined
    at simulaOperacoes:689
(anonymous) @ simulaOperacoes:689

 
If anyone has any tips how can I adjust and maintain this file without changing the core!
 
Hugs