⚠ In case you've missed it we are migrating 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 forum is read-only and soon will be archived. ⚠


jep

Member Since 06 Dec 2018
Offline Last Active Jul 25 2020 07:57 PM
-----

Topics I've Started

Error after integrate with adminlte

02 October 2019 - 11:59 PM

hello all!! thank you in advance for any help you can provide.

 

i have a little codeigniter project with grocery crud and mysql. it is working fine but i want to use adminlte in order to add new features.

 

im working with adminlte blank page template

 

versions-------------------------------------------

codeigniter 3.1.9

grocerucrud 1.6.3

adminlte 2

 

dir sctructure---------------------------------------

httdocs

-----------web

-----------------assets

--------------------------adminlte

 

controller------------------------------------------------------------------------------------------------------------------

public function f_cargadatos($v_where=null) {                                

try {

 

$v_where = "mhwh_fk_etarea!='Cancelado' AND mhwh_fk_etarea!='Vencido' AND mhwh_fk_etarea!='Realizado'";

 

$crud = new grocery_CRUD();

$this->load->config('grocery_crud');

$this->config->set_item('grocery_crud_file_upload_allow_file_types','gif|jpeg|jpg|png|pdf');

$crud->set_theme('datatables');

$crud->set_table('t_mhw_header');                                  

$crud->set_subject('Movimiento HW');

$crud->where($v_where);

 

$crud->required_fields('mhwh_id_ticket','mhwh_fhrealizacion','mhwh_fk_etarea');

 

$crud->columns(array( 'id_mhwh' , 'mhwh_fk_cliente' , 'mhwh_reponsable'  , 'mhwh_id_ticket' , 'mhwh_fk_sala' , 'mhwh_fk_etarea', 'mhwh_observaciones'));

 

$crud->fields('mhwh_id_ticket', 'mhwh_fhrealizacion', 'mhwh_fk_edificio', 'mhwh_fk_sala', 'mhwh_reponsable', 'mhwh_fk_cliente' , 'mhwh_observaciones', 'mhwh_firma', 'mhwh_fk_ssff', 'mhwh_fk_etarea', 'mhwh_creator','mhwh_updater');

 

$crud->field_type('mhwh_creator', 'invisible');

$crud->field_type('mhwh_updater', 'invisible');

                                                                                                          

$crud->set_relation('mhwh_fk_tdocumento' ,'lst_tipo_documentos' ,'id_tdocumentos'      );

$crud->set_relation('mhwh_fk_etarea'        ,'lst_estado_tareas' ,'id_estado_tarea');

$crud->set_relation('mhwh_reponsable' ,'lst_responsables'        ,'id_resp_nombre');

$crud->set_relation('mhwh_fk_ssff'            ,'lst_operariosssff'           ,'id_opersssff');

$crud->set_relation('mhwh_fk_sala'            ,'lst_salas'          ,'id_salas');

$crud->set_relation('mhwh_fk_edificio' ,'lst_edificios'          ,'id_edificios');

$crud->set_relation('mhwh_fk_cliente' ,'lst_clientes','id_cliente');

 

$crud->set_rules ('mhwh_id_ticket','Solicitud N°','trim|alpha_numeric_spaces|required');

$output = $crud->render ();                 

$this->_load_outputHead($output);

 

}catch(Exception $e) { show_error($e->getMessage().' --- ‘. $e->getTraceAsString());  }}

 

public function _load_outputHead($output = null)

{           $this->load->view('app_3wmhw/view’, (array)$output); }

 

view-----------------------------------------------------------------------------------------------------------------------

<?php $this->load->view('app_3widc/vh_3widc'); ?>
 
    <!-- Main content -->
    <section class="content">
 
      <!-- Default box -->
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title">Title</h3>
 
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip"
                    title="Collapse">
              <i class="fa fa-minus"></i></button>
     </div>
        </div>
        <div class="box-body">
 
 
            <div class="box">
              <div class="box-header with-border">
                <h3 class="box-title">Collapsible Box Example</h3>
                <div class="box-tools pull-right">
                  <!-- Collapse Button -->
                  <button type="button" class="btn btn-box-tool" data-widget="collapse">
                    <i class="fa fa-minus"></i>
                  </button>
                </div>
                <!-- /.box-tools -->
              </div>              <!-- /.box-header -->
              <div class="box-body">  
 
 
                        <!-- BODY   --------------------------------------------------------------------------------------------- -->
                        <div class="w3-display-container">
                            <div class="w3-display-middle w3-large " id=" body" style="padding: 10px;" >  
                                   <?php echo $output;   ?>
                            </div>
                        </div>
                        <!-- FIN_BODY------------------------------------------------------------------------------------------------- -->
 
 
              </div>
            </div>            <!-- /.box -->
        </div>        <!-- /.box-body -->
        <div class="box-footer">  Footer  </div>        <!-- /.box-footer-->
      </div>      <!-- /.box -->
    </section>    <!-- /.content -->
  </div>  <!-- /.content-wrapper -->
 
 
  <?php $this->load->view('app_3widc/vf_3widc'); ?>

 

 

 

error----------------------------------------------------------------------------------------------------------------------

Uncaught TypeError: $(...).dataTable is not a function
    at loadDataTable (datatables.js:141)
    at HTMLTableElement.<anonymous> (datatables.js:59)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)
    at HTMLDocument.<anonymous> (datatables.js:52)
    at j (jquery-1.11.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js:2)
    at Function.ready (jquery-1.11.1.min.js:2)
    at HTMLDocument.J (jquery-1.11.1.min.js:2)

 

 

tries---------------------------------------------------------

add all jquery loads at the end of adminlte "after jquery was loaded"

 

 

<!-- jQuery 3  -->
<script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url();?>assets/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="<?php echo base_url();?>assets/adminlte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="<?php echo base_url();?>assets/adminlte/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url();?>assets/adminlte/dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url();?>assets/adminlte/dist/js/demo.js"></script>
<!--
      GROCERY CRUD 
      <script src="<?php echo base_url();?>assets/grocery_crud/js/jquery-1.11.1.min.js"></script>
-->
<script src="<?php echo base_url();?>assets/grocery_crud/js/common/list.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables-extras.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/js/datatables.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/themes/datatables/extras/TableTools/media/js/TableTools.min.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.fancybox-1.3.4.js"></script>
<script src="<?php echo base_url();?>assets/grocery_crud/js/jquery_plugins/jquery.easing-1.3.pack.js"></script>

 

 

 

Any ideas?

im not developer but i will try to answer all your questions to anyone interested in help me

 

best regards


Selectionbox - set_relation not working?

29 April 2019 - 07:06 PM

hello all, in advance THANK YOU VERY MUCH for your help and sorry for my english ;-)
 
i'm working on a form that register building access.
After entry all data in form (view FUNCTION) and i click save button, it shows me error (view ERROR LOG).
 
i have several tables (2) where store data, (1) table that help fill table_1, same than other which i have no problems.-
 
problem is that crud form send the id number (INT) either name (VARCHAR)
 
selection box:
$crud->set_relation('mhwh_reponsable' ,'lst_responsables' ,'resp_nombre' );
 
as you can see i have several selection boxes and all of them are working fine.
 
MYSQL side
-data is equal = varchar (55)
-collate is equal = 'utf8mb4_0900_ai_ci'
-relation are set = 1 to n
-i have created new table and made new relations and index and im keeping this error.
 
 
VERSIONS
CodeIgniter v3.1.9
GroceryCrud v1.6.1
database: mysql - > 8.0.11

 

 
//-----------------------------------------------------------------------------------------------//
FUNCTION
//-----------------------------------------------------------------------------------------------//
$crud = new grocery_CRUD();
$this->load->config('grocery_crud');
$this->config->set_item('grocery_crud_file_upload_allow_file_types','gif|jpeg|jpg|png|pdf');
$crud->set_theme('datatables'); //  datatables o flexigriS
$crud->set_table('t_mhw_header'); //tab_movimiento_hw
$crud->set_subject('Movimiento HW');


$crud->where('mhwh_fk_etarea','En Progreso');


$crud->fields( 'mhwh_id_ticket', 'mhwh_fhrealizacion', 'mhwh_fk_edificio', 'mhwh_fk_sala',
'mhwh_reponsable', 'mhwh_fk_tdocumento', 'mhwh_ndocumento', 'mhwh_fk_cliente', 
'mhwh_observaciones', 'mhwh_firma', 'mhwh_fk_ssff', 'mhwh_fk_etarea');


$crud->columns(array('id_mhwh' ,'mhwh_fk_cliente', 'mhwh_reponsable' ,'mhwh_id_ticket',
'mhwh_fk_sala' ,'mhwh_fk_etarea',  'mhwh_observaciones'));


$crud->set_relation('mhwh_fk_tdocumento' ,'lst_tipo_documentos' ,'id_tdocumentos' );
$crud->set_relation('mhwh_fk_etarea' ,'lst_estado_tareas' ,'id_estado_tarea' );
$crud->set_relation('mhwh_reponsable' ,'lst_responsables' ,'resp_nombre' );
$crud->set_relation('mhwh_fk_ssff' ,'lst_operariosssff' ,'id_opersssff' );
$crud->set_relation('mhwh_fk_sala' ,'lst_salas' ,'id_salas' );
$crud->set_relation('mhwh_fk_edificio' ,'lst_edificios' ,'id_edificios' );
$crud->set_relation('mhwh_fk_cliente' ,'lst_clientes' ,'id_cliente' );


$crud->set_field_upload('mhwh_firma','assets/Firmas');


$crud->unset_clone();  // quitar boton de clonacion
$crud->unset_read();  // quitar boton de lectura, ingresando al tkt
$crud->unset_delete(); // quitar boton de elimiacion


$crud->add_action('HW' ,'','','ui-icon-clipboard' ,array($this,'fadd_add_hardware'));
$crud->add_action('Print' ,'','','ui-icon-print' ,array($this,'fadd_prt_movimiento_hw'));


$output = $crud->render();
$this->_load_outputHead($output);
 
//-----------------------------------------------------------------------------------------------//
ERROR LOG
//-----------------------------------------------------------------------------------------------//
ERROR - 2019-04-26 22:55:03 --> Query error: Cannot add or update a child row: 
a foreign key constraint fails (`idcdb`.`t_mhw_header`, CONSTRAINT `FK_t_mhw_header_lst_responsables` FOREIGN KEY (`mhwh_reponsable`) REFERENCES `lst_responsables` (`resp_nombre`)) 
- Invalid query: 
INSERT INTO `t_mhw_header` (`mhwh_id_ticket`, `mhwh_fhrealizacion`, `mhwh_fk_edificio`, `mhwh_fk_sala`, `mhwh_reponsable`, `mhwh_fk_tdocumento`, `mhwh_ndocumento`, `mhwh_fk_cliente`, `mhwh_observaciones`, `mhwh_firma`, `mhwh_fk_ssff`, `mhwh_fk_etarea`) 
VALUES ('Q00000000', NULL, 'EDIFICIO', 'UBICACION', '2789', 'TIPO-DOCUMENTO', '00000000', 'NOMBRE_CLIENTE', 'OBSERVACIONES', NULL, 'NOMBRE_SSFF', 'En Progreso')
 
'27789' MIGHT BE A NAME, NOT ID RECORD.
//-----------------------------------------------------------------------------------------------//
SQL
//-----------------------------------------------------------------------------------------------//
//---------------------------------------------------------//
TABLE_1
//---------------------------------------------------------//
CREATE TABLE `lst_responsables` (
`resp_nombre` VARCHAR(55) NULL DEFAULT NULL,
`resp_tdocumento` VARCHAR(55) NULL DEFAULT NULL,
`resp_ndocumento` VARCHAR(15) NULL DEFAULT NULL,
`resp_legajo` VARCHAR(15) NULL DEFAULT NULL,
`resp_empresa` VARCHAR(55) NULL DEFAULT NULL,
`resp_telefono` VARCHAR(22) NULL DEFAULT NULL,
`resp_interno` VARCHAR(11) NULL DEFAULT NULL,
`resp_email` VARCHAR(55) NULL DEFAULT NULL,
`resp_udf__Rol` VARCHAR(22) NULL DEFAULT NULL,
`resp_udf__Rol2` VARCHAR(22) NULL DEFAULT NULL,
`id_resp_autorizante` INT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id_resp_autorizante`),
INDEX `resp_nombre` (`resp_nombre`)
)
COLLATE='utf8mb4_0900_ai_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2790
;
//---------------------------------------------------------//
TABLE_2
//---------------------------------------------------------//
CREATE TABLE `t_mhw_header` (
`id_mhwh` INT(11) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT 'ok',
`mhwh_id_ticket` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fhrealizacion` DATETIME NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_edificio` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_sala` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_reponsable` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_tdocumento` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_ndocumento` VARCHAR(11) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_cliente` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_observaciones` VARCHAR(255) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_firma` VARCHAR(255) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_ssff` VARCHAR(55) NULL DEFAULT NULL COMMENT 'ok',
`mhwh_fk_etarea` VARCHAR(55) NULL DEFAULT NULL,
PRIMARY KEY (`id_mhwh`),
INDEX `id_movimientohw` (`mhwh_id_ticket`),
INDEX `FK_tab_mov_hw_header_lst_estado_tareas` (`mhwh_fk_etarea`),
INDEX `FK_tab_mov_hw_header_lst_operariosssff` (`mhwh_fk_ssff`),
INDEX `FK_tab_mov_hw_header_lst_salas` (`mhwh_fk_sala`),
INDEX `FK_tab_mov_hw_header_lst_tipo_documentos` (`mhwh_fk_tdocumento`),
INDEX `FK_t_mhw_header_lst_edificios` (`mhwh_fk_edificio`),
INDEX `FK_t_mhw_header_lst_clientes` (`mhwh_fk_cliente`),
INDEX `mhwh_reponsable` (`mhwh_reponsable`),
CONSTRAINT `FK_t_mhw_header_lst_clientes` FOREIGN KEY (`mhwh_fk_cliente`) REFERENCES `lst_clientes` (`id_cliente`),
CONSTRAINT `FK_t_mhw_header_lst_edificios` FOREIGN KEY (`mhwh_fk_edificio`) REFERENCES `lst_edificios` (`id_edificios`),
CONSTRAINT `FK_t_mhw_header_lst_responsables` FOREIGN KEY (`mhwh_reponsable`) REFERENCES `lst_responsables` (`resp_nombre`),
CONSTRAINT `FK_tab_mov_hw_header_lst_estado_tareas` FOREIGN KEY (`mhwh_fk_etarea`) REFERENCES `lst_estado_tareas` (`id_estado_tarea`),
CONSTRAINT `FK_tab_mov_hw_header_lst_operariosssff` FOREIGN KEY (`mhwh_fk_ssff`) REFERENCES `lst_operariosssff` (`id_opersssff`),
CONSTRAINT `FK_tab_mov_hw_header_lst_salas` FOREIGN KEY (`mhwh_fk_sala`) REFERENCES `lst_salas` (`id_salas`),
CONSTRAINT `FK_tab_mov_hw_header_lst_tipo_documentos` FOREIGN KEY (`mhwh_fk_tdocumento`) REFERENCES `lst_tipo_documentos` (`id_tdocumentos`)
)
COLLATE='utf8mb4_0900_ai_ci'
ENGINE=InnoDB
AUTO_INCREMENT=55
;
please, let me know if you need some information.
thank youy very much in advace for all your help, jose!