diff --git a/ci4/app/Entities/Configuracion/FestivoEntity.php b/ci4/app/Entities/Configuracion/FestivoEntity.php new file mode 100644 index 00000000..0088deb2 --- /dev/null +++ b/ci4/app/Entities/Configuracion/FestivoEntity.php @@ -0,0 +1,14 @@ + null, + "date" => null, + ]; + protected $casts = []; +} diff --git a/ci4/app/Models/Configuracion/FestivoModel.php b/ci4/app/Models/Configuracion/FestivoModel.php new file mode 100755 index 00000000..5af52bab --- /dev/null +++ b/ci4/app/Models/Configuracion/FestivoModel.php @@ -0,0 +1,132 @@ + [ + "label" => "Festivos.fecha", + "rules" => "required|datetime", + ], + + ]; + + protected $validationMessages = [ + "alto" => [ + "integer" => "Imposiciones.validation.alto.integer", + "required" => "Imposiciones.validation.alto.required", + ], + "ancho" => [ + "integer" => "Imposiciones.validation.ancho.integer", + "required" => "Imposiciones.validation.ancho.required", + ], + "etiqueta" => [ + "max_length" => "Imposiciones.validation.etiqueta.max_length", + ], + "maquina" => [ + "max_length" => "Imposiciones.validation.maquina.max_length", + ], + "orientacion" => [ + "in_list" => "Imposiciones.validation.orientacion.in_list", + ], + "unidades" => [ + "integer" => "Imposiciones.validation.unidades.integer", + ], + "imposicion_esquema_id" => [ + "integer" => "Imposiciones.validation.unidades.integer", + ], + ]; + + /** + * Get resource data. + * + * @param string $search + * + * @return \CodeIgniter\Database\BaseBuilder + */ + public function getResource(string $search = "") + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.id AS id, t1.ancho AS ancho, t1.alto AS alto, t1.unidades AS unidades, t1.orientacion AS orientacion, t1.maquina AS maquina, t1.etiqueta AS etiqueta" + ); + + return empty($search) + ? $builder + : $builder + ->groupStart() + ->like("t1.id", $search) + ->orlike("t1.ancho", $search) + ->orLike("t1.alto", $search) + ->orLike("t1.unidades", $search) + ->orLike("t1.orientacion", $search) + ->orLike("t1.maquina", $search) + ->orLike("t1.etiqueta", $search) + ->orlike("t1.id", $search) + ->orLike("t1.ancho", $search) + ->orLike("t1.alto", $search) + ->orLike("t1.unidades", $search) + ->orLike("t1.orientacion", $search) + ->orLike("t1.maquina", $search) + ->orLike("t1.etiqueta", $search) + ->groupEnd(); + } + + public function querySelect(?string $q) + { + $query = $this->builder()->select([ + "id", + "CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as name", + "COALESCE(lg_imposiciones.etiqueta,'" . lang("Produccion.imposicion_no_label") . "') as description" + ]); + if ($q) { + $query->orLike("CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto)", $q); + $query->orLike("lg_imposiciones.etiqueta", $q); + } + return $query + ->orderBy('id', 'ASC') + ->get()->getResultArray(); + } + public function queryDatatable() + { + return $this->builder() + ->select([ + "lg_imposiciones.id", + "lg_imposiciones.ancho", + "lg_imposiciones.alto", + "lg_imposiciones.unidades", + "lg_imposiciones.maquina", + "lg_imposiciones.orientacion", + "lg_imposiciones.etiqueta", + "imposicion_esquemas.id as esquemaId", + "imposicion_esquemas.name as esquemaName" + ]) + ->join("imposicion_esquemas","imposicion_esquemas.id = lg_imposiciones.imposicion_esquema_id","left") + ->where('lg_imposiciones.deleted_at', null); + } + public static function datatable_buttons(int $id) + { + $btn = ""; + if(auth()->user()->inGroup("admin")){ + $btn.=""; + $btn.=""; + } + return $btn; + } +}