=head1 NAME App::api::controls::Control_Check =head1 SYNOPSIS my $check = Component__Get(CONTROL_CHECK, ['check']); =head1 DESCRIPTION Control para marcar/desmarcar una opción. =head1 ARGUMENTS ( TYPE => 'Check', ID => 'check' (default), INFO => 1 (show info in header; default) or 0 (don't show), LABEL => 'Check' (default), LABEL_INFO => Same as LABEL (default), DEFAULT => 0 (unchecked; default) or 1 (checked) ) =cut use strict; use warnings; use utf8; package Dam::Components::Controls::Check; use Exporter qw(import); our @EXPORT = qw( Control__html Control__js Get ); use Dam::Util; use Dam::DamLogic; my $ID_DEFAULT = 'check'; sub __arguments { my $arg_ref = shift; $$arg_ref{LABEL} = 'Check' if is_empty($$arg_ref{LABEL}); $$arg_ref{LABEL_INFO} = $$arg_ref{LABEL} if is_empty($$arg_ref{LABEL_INFO}); check_arguments($arg_ref, TYPE => [ ARG_REQUIRED ], ID => [ ARG_DEFAULT, $ID_DEFAULT ], INFO => [ ARG_DEFAULT, 1, 0 ], LABEL => [ ARG_REQUIRED ], LABEL_INFO => [ ARG_REQUIRED ], DEFAULT => [ ARG_DEFAULT, 0, 1 ] ); } sub Control__html { my ($self, $arg_ref, $info_ref) = @_; __arguments($arg_ref); my $check_value = !is_report() ? $$arg_ref{DEFAULT} : is_empty(cgiapp_param($$arg_ref{ID})) ? 0 : 1; push(@{$info_ref}, { DATA => _t('Option'), VALUE => $$arg_ref{LABEL_INFO} }) if $$arg_ref{INFO} && $check_value; return strval('