Forked from camilamoreiradev/Reaproveitando botões da barra de ferramentas da grid [SCRIPTCASE]
Created
February 3, 2023 06:25
-
-
Save notelseit/a67fc67c3c84659637eb7096e6a8889c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //onScriptInit | |
| [sw_i] = array(); | |
| echo <<<HTML | |
| <style> | |
| input#rec_f0_top { | |
| width: 160px !important; | |
| padding: 10px !important; | |
| } | |
| </style> | |
| <script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script> | |
| <script> | |
| $(document).ready(function() { | |
| $('#sc_alterar_data_top').removeAttr('onclick'); | |
| $('#rec_f0_top').attr('type', 'date'); | |
| $('#brec_top').removeAttr('onclick').removeClass('scButton_default'); | |
| $('#rec_f0_top').on('change', function() { | |
| var dt = $(this).val(); | |
| Cookies.set('sw_dt', dt); | |
| }); | |
| $('#sc_alterar_data_top').on('click', function() { | |
| if($('#rec_f0_top').val()=="") { | |
| Swal.fire({ | |
| title: 'Ops!', | |
| text: 'Por favor, preencha a data para alterar.', | |
| icon: 'error' | |
| }); | |
| } else { | |
| sc_btn_alterar_data(); | |
| } | |
| }); | |
| }); | |
| </script> | |
| HTML; | |
| //onRecord botão | |
| [sw_i][] = {requisition_id}; | |
| //onFinish botão | |
| if(isset($_COOKIE['sw_dt']) && (!empty($_COOKIE['sw_dt']))) { | |
| $update = "UPDATE tb_requisitions SET requisition_target_fill_date = '".$_COOKIE['sw_dt']."' WHERE requisition_id IN (".implode(',', [sw_i]).")"; | |
| sc_exec_sql($update); | |
| sc_commit_trans(); | |
| sc_redir('grid_tb_requisitions.php'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment