Compare commits

...

10 Commits

Author SHA1 Message Date
mynah
7c4cd01e15 doployrpass711 2020-07-11 08:35:55 +02:00
mynah
5549827fe3 deploying passwd 2020-07-11 07:28:07 +02:00
mynah
f0fa09e315 zero merge 2020-07-10 14:59:22 -05:00
mynah
0163956ce4 live changes 2020-07-10 21:22:01 +02:00
mynah
45efdf7934 radiopass 2020-05-27 15:28:41 -05:00
mynah
f22b3a797e Merge branch 'zero' into 'master'
Zero

See merge request mynah/dojo!5
2020-01-29 09:37:20 +00:00
mynah
8cede80fe7 finspay 2020-01-29 03:27:24 -06:00
mynah
57f19e749d finspay 2020-01-29 03:13:02 -06:00
mynah
72f95e5800 Merge branch 'zero' into 'master'
Zero

See merge request mynah/dojo!4
2020-01-23 01:21:42 +00:00
mynah
174f4b0756 parriba 2020-01-22 18:22:31 -06:00
51 changed files with 865 additions and 670 deletions

View File

@@ -56,24 +56,25 @@ sub startup {
$logged_in->get('/radio')->to('home#radio'); $logged_in->get('/radio')->to('home#radio');
# =================== # ===================
# login user grulla = # login any temp pass=
my $usert = $r->under('/')->to('users#is_tmp');
# common grulla user # common grulla user
my $user = $r->under('/')->to('users#is_grulla'); my $user = $r->under('/')->to('users#is_grulla');
$user->any('/ccast')->to('home#bcast'); $user->any('/ccast')->to('home#bcast');
# personal # personal
my $guest = $r->under('/')->to('users#is_grulla_tmp'); my $guest = $r->under('/')->to('users#is_grulla_tmp');
$guest->any('/bcast')->to('home#bcast'); $guest->any('/bcast')->to('home#bcast');
$guest->any('/radiop')->to('home#radiop');
# =================== # ===================
# admin ======================================================================= # admin =======================================================================
my $admin = $r->under('/admin')->to('users#is_admin'); my $admin = $r->under('/admin')->to('users#is_admin');
$admin->any('')->to('admin#admin'); $admin->any('')->to('admin#admin');
$admin->any('home')->to('admin#admin'); $admin->any('home')->to('admin#home');
$admin->any('radio')->to('admin#radio'); $admin->any('radio')->to('admin#radio');
$admin->any('eventos')->to('admin#eventos'); $admin->any('eventos')->to('admin#eventos');
$admin->any('eventos/:type'=> [type=>['e','p','c']])->to('admin#eventos'); $admin->any('eventos/:type'=> [type=>['e','p','c']])->to('admin#eventos');
$admin->any('mensajes')->to('admin#mensajes'); $admin->any('mensajes')->to('admin#mensajes');
$admin->any('tienda')->to('admin#tienda');
$admin->any('json/:dreq/:id')->to('admin#json'); $admin->any('json/:dreq/:id')->to('admin#json');
# ============================================================================= # =============================================================================

View File

@@ -5,78 +5,103 @@ use Mojo::Base 'Mojolicious::Controller';
use Dojo::Support qw{ log }; use Dojo::Support qw{ log };
# pagina y mensajes ===========================================================
# Admin =======================================================================
sub admin{ sub admin{
my $c= shift;
$c->redirect_to('/admin/home');
}
sub home{
my $c=shift; my $c=shift;
my $n=$c->param("dreq")//""; $c->dbv->umod($c->param('link'),$c->param('update'))
my $json = {status => "304"}; if (($c->param("hup") // " " )=~/Cambiar/);
$json = ($c->dbv->rmsgid ($c->param('id')))[0] if ($n =~m/^mensajes$/); $c->stash(template=>"admin/home");
$json = ($c->dbv->ecourse($c->param('id')))[0] if ($n =~m/^ecourse$/); $c->stash(layout=>"admin");
$json = ($c->dbv->qcourse($c->param('id')))[0] if ($n =~m/^qcourse$/); $c->stash( $c->dbv->mod);
$json = ($c->dbv->qplace ($c->param('id')))[0] if ($n =~m/^qplace$/); }
$c->render(json=>$json);
sub radio{
my $c=shift;
$c->dbv->umod($c->param('link'),'rmod')
if (($c->param("hup") // " " )=~/Cambiar/);
$c->dbg->ugrulla_pass($c->param('gpass'))
if (($c->param("pup") // " " )=~/Cambiar/);
$c->stash($c->dbv->mod);
$c->stash($c->dbg->grulla_pass);
$c->stash(apend => ["admin/candySwitch"]);
$c->stash(template=>"admin/radio");
$c->stash(layout=>"admin");
}
sub mensajes{
my $c=shift;
$c->stash( h=>$c->dbv->msg_heads);
$c->stash(template=>"admin/mensajes");
$c->stash(layout=>"admin");
} }
# Eventos ===================================================================== # Eventos =====================================================================
sub admin_eventos{ sub eventos{
my $c=shift; my $c=shift;
if ( (my $t=$c->param('type') // "") =~/[ecp]/){ if ( (my $t=$c->param('type') // "") =~/[ecp]/){
my $id=$c->param('id'); my $id=$c->param('id');
my $req=$c->param('req'); my $req=$c->param('req');
if ( $req eq "Eliminar"){ if ( $req eq "Eliminar"){
$c->dbv->event_del($id) if ($t eq 'e'); $c->mproc->event_del($id) if ($t eq 'e');
$c->dbv->course_del($id) if ($t eq 'c'); $c->mproc->course_del($id) if ($t eq 'c');
$c->dbv->place_del($id) if ($t eq 'p'); $c->mproc->place_del($id) if ($t eq 'p');
} }
elsif( $req eq "Aceptar"){ elsif( $req eq "Aceptar"){
if($t eq 'e'){ if($t eq 'e'){
my @list=map{$c->param($_)}qw/eplace yini mini dini yend mend dend cost promo pen ecourse eimg een id/; my @list=map{$c->param($_)}qw/eplace yini mini dini yend mend dend cost promo pen ecourse eimg een id/;
$c->dbv->event_up(@list) if ($id ==0); $c->mproc->event_up(@list) if ($id ==0);
$c->dbv->event_ch(@list) if ($id >0); $c->mproc->event_ch(@list) if ($id >0);
} }
if($t eq 'c'){ if($t eq 'c'){
my @list=map{$c->param($_)}qw/cname csubjects cservices cen id/; my @list=map{$c->param($_)}qw/cname csubjects cservices cen id/;
$c->dbv->course_up(@list) if ($id ==0); $c->mproc->course_up(@list) if ($id ==0);
$c->dbv->course_ch(@list) if ($id >0); $c->mproc->course_ch(@list) if ($id >0);
} }
if($t eq 'p'){ if($t eq 'p'){
my @list=map{$c->param($_)}qw/pname paddr pobs pto pst pco plat plng pen id/; my @list=map{$c->param($_)}qw/pname paddr pobs pto pst pco plat plng pen id/;
$c->dbv->place_up(@list) if ($id ==0); $c->mproc->place_up(@list) if ($id ==0);
$c->dbv->place_ch(@list) if ($id >0); $c->mproc->place_ch(@list) if ($id >0);
} }
} }
$c->redirect_to("/admin/eventos"); $c->redirect_to("/admin/eventos");
} }
$c->stash( $c->stash(
courses=>$c->dbv->courses, courses=>$c->mproc->courses,
places=>$c->dbv->places, places=>$c->mproc->places,
months=>$c->dbv->months, months=>['enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre' ],
events=>$c->dbv->events, events=>$c->mproc->events,
img=>$c->dbv->eimgList, img=>$c->mproc->eimgList,
); );
$c->stash(template=>"home/admin/event"); $c->stash(template=>"admin/event");
$c->stash(layout=>"admin");
}
sub admin_tienda{
my $c=shift;
$c->stash(u=>$c->dbv->user_heads);
$c->stash(s=>$c->dbv->store_heads);
$c->stash(template=>"home/admin/tienda");
$c->stash(layout=>"admin"); $c->stash(layout=>"admin");
} }
# Funciones auxiliares ======================================================== # Funciones auxiliares ========================================================
sub admin_json{ sub json{
my $c=shift; my $c=shift;
my $id = $c->param('id'); my $id = $c->param('id');
my $req = $c->param('dreq'); my $req = $c->param('dreq');
my $json = "304"; my $json = "304";
$json = $c->dbv->astore($id) if $req=~/tienda/; $json = $c->dbv->msg($id) if $req=~/mensaje/;
$json = $c->dbv->course($id) if $req=~/course/; $json = $c->dbv->rmsgid ($id) if $req =~/^mensajes$/;
$json = $c->dbv->place($id) if $req=~/place/;
$json = $c->dbv->eventa($id) if $req=~/event/; $json = $c->mproc->course($id) if $req=~/course/;
$json = $c->mproc->place($id) if $req=~/place/;
$json = $c->mproc->eventa($id) if $req=~/event/;
$json = $c->mproc->ecourse($id) if $req =~/^ecourse$/;
$json = $c->mproc->qcourse($id) if $req =~/^qcourse$/;
$json = $c->mproc->qplace ($id) if $req =~/^qplace$/;
$c->render(json=>$json); $c->render(json=>$json);
} }
1;

View File

@@ -1,7 +1,7 @@
package Dojo::Controller::Home; package Dojo::Controller::Home;
use Mojo::Base 'Mojolicious::Controller'; use Mojo::Base 'Mojolicious::Controller';
use Mojo::Template; use Mojo::Template;
use Dojo::Support qw{ log get_names}; use Dojo::Support qw{send_mail log get_names};
use JSON; use JSON;
use Data::Dumper; use Data::Dumper;
#========================= #=========================
@@ -116,6 +116,13 @@ sub radio{
$c->stash(nick=>$c->session("nick")); $c->stash(nick=>$c->session("nick"));
} }
sub radiop{
my $c=shift;
$c->stash(layout=> "defaultContact");
$c->stash($c->dbv->mod);
$c->stash(nick=>$c->session("nick"));
}
sub candy{ sub candy{
my $c=shift; my $c=shift;
$c->stash( css=>["/ext/candy/libs.min.css","/home/candy/default.css"]); $c->stash( css=>["/ext/candy/libs.min.css","/home/candy/default.css"]);
@@ -128,51 +135,4 @@ sub candy{
#============================================================================== #==============================================================================
# Admin =======================================================================
sub admin{
my $c= shift;
$c->redirect_to('/admin/home');
}
sub admin_home{
my $c=shift;
$c->dbv->umod($c->param('link'),$c->param('update'))
if (($c->param("hup") // " " )=~/Cambiar/);
$c->stash(template=>"home/admin/home");
$c->stash(layout=>"admin");
$c->stash( $c->dbv->mod);
}
sub admin_radio{
my $c=shift;
$c->dbv->umod($c->param('link'),'rmod')
if (($c->param("hup") // " " )=~/Cambiar/);
$c->dbg->ugrulla_pass($c->param('gpass'))
if (($c->param("pup") // " " )=~/Cambiar/);
$c->stash($c->dbv->mod);
$c->stash($c->dbg->grulla_pass);
$c->stash(apend => ["home/admin/candySwitch"]);
$c->stash(template=>"home/admin/radio");
$c->stash(layout=>"admin");
}
sub admin_mensajes{
my $c=shift;
$c->stash( h=>$c->dbv->msg_heads);
$c->stash(template=>"home/admin/mensajes");
$c->stash(layout=>"admin");
}
sub admin_json{
my $c=shift;
my $id = $c->param('id');
my $req = $c->param('dreq');
my $json = "304";
$json = $c->dbv->msg($id) if $req=~/mensaje/;
$json = $c->dbv->user($id) if $req=~/usuarios/;
$c->render(json=>$json);
}
#==============================================================================
1; 1;

View File

@@ -1,7 +1,7 @@
package Dojo::Controller::Proc; package Dojo::Controller::Proc;
use Mojo::Base 'Mojolicious::Controller'; use Mojo::Base 'Mojolicious::Controller';
use Mojo::Template; use Mojo::Template;
use Dojo::Support qw{ log get_names}; use Dojo::Support qw{ send_mail log get_names};
use LWP::UserAgent; use LWP::UserAgent;
use HTTP::Request::Common; use HTTP::Request::Common;
@@ -41,6 +41,7 @@ sub spay{
else { else {
$c->stash(layout=> "defaultContact"); $c->stash(layout=> "defaultContact");
} }
$c->stash(stripe_sk_public => Dojo::Conf::STRIPE_SK_PUBLIC );
$c->stash($data); $c->stash($data);
} }
@@ -53,81 +54,73 @@ sub intentCreate{
return 0; return 0;
} }
my $data=$c->mproc->intentCreate($c->req->json->{'tid'}); my $json = $c->req->json;
# if(!@$data){ intentError($c,"event not found",1); return;}; my $data=$c->mproc->intentCreate($json->{'tid'});
my $pmi=$c->req->json->{'payment_method_id'} // 0; if ($data==0){intentError($c,"store id error",1); return;}
my $amount = $data->{'precio'} * $c->req->json->{'mq'} ; if ( $c->mproc->userDataSanity($json) != 0) {
my $description = $data->{'nombre'}; intentError($c,"data sanity error",1); return;
my $max_time = 9; }
my $max_time = $data->{'meses'};
my @count = (0,3,6,9,12,18); #arregla esta atrocidad
my $idisc= $data->{'desc_estado'}; #immediate payment discount
my $discount = $data->{'descuento'}; #disoutn %
my $pl = $json->{'pl'}; # 0 imediate. 1-5: 3,6,9,12,18 months installment
my $plan = $count[$pl];
my $pmi=$json->{'payment_method_id'};
my $amount = $data->{'precio'} * $json->{'mq'} ;
$amount = $amount * (1 - ($discount/100 )) if($pl==0 && $idisc == 1 && $discount > 0);
my $api_create_path='https://api.stripe.com/v1/payment_intents'; my $api_create_path='https://api.stripe.com/v1/payment_intents';
my $payment_info=[ my $payment_info=[
'payment_method'=>$pmi, 'payment_method'=>$pmi,
'amount'=>$amount*100, 'amount'=>int($amount*100),
'currency'=>'mxn', 'currency'=>'mxn',
'description'=>$description, 'description'=>$data->{'nombre'},
'payment_method_options[card][installments][enabled]'=>'true' 'payment_method_options[card][installments][enabled]'=>'true'
]; ];
my $r=stripeAppi($api_create_path,$payment_info); my $r=stripeAppi($api_create_path,$payment_info);
if ($r==0){intentError($c,"api create error",1); return;} if ($r==0){intentError($c,"api create error",1); return;}
my $t->{intent_id}=$r->{id};
foreach (@{$r->{payment_method_options}{card}{installments}{available_plans}}){ if ($pl > 0) {
push (@{$t->{available_plans}}, $_) unless ($_->{count} > $max_time);
unless (defined( $r->{'payment_method_options'}->{'card'}->{'installments'}->{'available_plans'} ) ){
intentError($c,"api can't accept installment",1); return;
} }
$c->render(json=>$t);
return 0;
}
sub intentConfirm{
my $c = shift;
my $max_time = 9;
unless (defined ($c->req->json)){
$c->stash(layout=>'clean');
$c->render(template=>'home/not_found', status=>404);
return;
} }
unless ($c->mproc->intentSanity($c->req->json) == 0 ){
intentError($c,"sanity failed",0); return; }
my $data = $c->req->json; #=====================================================
my $pii = $data->{'payment_intent_id'}; #intent confirm ======================================
my $plan = $data->{'selected_plan'} // 0;
my $pii = $r->{'id'};
my $api_confirm_path = "https://api.stripe.com/v1/payment_intents/$pii/confirm"; my $api_confirm_path = "https://api.stripe.com/v1/payment_intents/$pii/confirm";
my $cplan = 0; my $cplan = 0;
if ($plan != 0){ if ($plan != 0){
if ($plan->{count} > $max_time) {
intentError($c,'max time installment attempt error',3);
return 0;
}
$cplan = [ $cplan = [
'payment_method_options[card][installments][plan][type]'=>'fixed_count', 'payment_method_options[card][installments][plan][type]'=>'fixed_count',
'payment_method_options[card][installments][plan][interval]'=>'month', 'payment_method_options[card][installments][plan][interval]'=>'month',
'payment_method_options[card][installments][plan][count]'=>$plan->{count}, 'payment_method_options[card][installments][plan][count]'=>$plan,
] ]
} }
if ( my $rr = stripeAppi($api_confirm_path,$cplan);
intentCheck( if ($rr==0){intentError($c,"api confirm error post",2); return;}
$c, if ($rr->{'status'} ne "succeeded" ){intentError($c,"payment not completed,2"); return;}
$data->{'payment_intent_id'}, #======================================================
$data->{'tid'}, # end and send messages ================================
$data->{'mq'}
) == -1) {
intentError($c,"api confirm error pre",2); return;
}
my $r = stripeAppi($api_confirm_path,$cplan); $c->mproc->intentConfirm($json,$rr);
if ($r==0){intentError($c,"api confirm error post",2); return;}
if ($r->{'status'} ne "succeeded" ){intentError($c,"payment not completed,2"); return;} map { send_mail(@$_) }$c->mproc->notify($json,$rr);
$c->mproc->intentConfirm($data,$r);
my $rtt = { my $rtt = {
'status'=>$r->{'status'}, 'status'=>$rr->{'status'},
'plan' => $r->{'payment_method_options'}{'card'}{'installments'}{'plan'}, 'pl' => $rr->{'payment_method_options'}{'card'}{'installments'}{'plan'},
}; };
$c->render(json=>$rtt); $c->render(json=>$rtt);
return 0; return 0;
@@ -146,14 +139,6 @@ sub userCheck{
return 0; return 0;
} }
sub intentCheck{
my ($c, $cid, $tid, $mq) = @_;
my $stripe = stripeAppi("https://api.stripe.com/v1/payment_intents/$cid",0);
my $data=$c->mproc->intentCreate($tid);
return -1 unless ( $stripe->{'amount'} == ($data->{'precio'} * $mq)*100);
return 0;
}
sub stripeAppi{ sub stripeAppi{
my ($path,$data) = @_; my ($path,$data) = @_;
my $req; my $req;

View File

@@ -22,8 +22,7 @@ sub reg{
$self->stash(layout=>"default"); $self->stash(layout=>"default");
} }
sub login {
sub login {
my $self = shift; my $self = shift;
#falta si el usuario ya está registrado y llama a login. #falta si el usuario ya está registrado y llama a login.
if (($self->session('ureq')//0) == 4){ #admin if (($self->session('ureq')//0) == 4){ #admin
@@ -47,7 +46,7 @@ sub reg{
my $user = $self->param('uname') // ''; my $user = $self->param('uname') // '';
my $pass = $self->param('pass') //''; my $pass = $self->param('pass') //'';
return $self->render unless my $pmid = $self->dbg->check($user, $pass); return $self->render unless my $pmid = $self->dbg->check($user, $pass);
$self->session(user => $user, pmid=>$pmid, nick=> $self->param('nick')); $self->session(expiration => 3600, user => $user, pmid=>$pmid, nick=> $self->param('nick'));
$self->redirect_to($self->session('prev')) ; $self->redirect_to($self->session('prev')) ;
} }
@@ -57,18 +56,22 @@ sub is_logged {
$self->session(ureq=>1,prev=>$self->url_for); $self->session(ureq=>1,prev=>$self->url_for);
$self->redirect_to('login'); $self->redirect_to('login');
} }
sub is_admin { sub is_admin {
my $self = shift; my $self = shift;
return 1 if ( ($self->session('pmid') //0) == 4); return 1 if ( ($self->session('pmid') //0) == 4);
$self->session(ureq=>4,prev=>$self->url_for); $self->session(ureq=>4,prev=>$self->url_for);
$self->redirect_to('login'); $self->redirect_to('login');
} }
sub is_grulla { sub is_grulla {
my $self = shift; my $self = shift;
return 1 if (($self->session('pmid')//0)>=2); return 1 if (($self->session('pmid')//0)>=2);
$self->session(ureq=>2,tmpreq=>0,prev=>$self->url_for); $self->session(ureq=>2,tmpreq=>0,prev=>$self->url_for);
$self->redirect_to('login'); $self->redirect_to('login');
} }
sub is_grulla_tmp{ sub is_grulla_tmp{
my $self = shift; my $self = shift;
return 1 if (($self->session('pmid')//0)>=2); return 1 if (($self->session('pmid')//0)>=2);

View File

@@ -1,11 +1,15 @@
insert into curso
(nombre,temario,servicios,estado) insert into curso (
values( nombre,
?, # cname subnombre,
?, # csubjects descripcion,
?, # cservices imagena,
case ? when "on" then 1 else 0 end #cen maestro,
); temario,
servicios,
estado
)
values(?,?,?,?,?,?,?,?);

View File

@@ -1,14 +1,20 @@
insert into evento
(lugar_id, fecha_inicio, fecha_fin, precio, promocion, promo_estado, curso_id, imagen_chica, estado) insert into curso_tienda (
values( lugar_id,
?, # eplace fecha_inicio,
concat(?,"-",?,"-",?), # yini - mini - dini fecha_fin,
concat(?,"-",?,"-",?), # yend - mend - dend imagen_chica,
?, # cost , comentario,
?, # promo , precio,
case ? when "on" then 1 else 0 end, # pen promocion,
?, # ecourse , promo_estado,
?, # eimg , playera_estado,
case ? when "on" then 1 else 0 end # een spay,
); store,
meses,
cupo,
curso_id,
estado
)
values( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);

View File

@@ -1,15 +1,15 @@
insert into lugar
(nombre,direccion,observacion,municipio,federativa,pais,lat,lng,estado) insert into curso_lugar (
values( nombre,
?, # pname direccion,
?, # paddr observacion,
?, # pobs municipio,
?, # pto federativa,
?, # pst pais,
?, # pco lat,
?, # plat lng,
?, # plng estado
case ? when "on" then 1 else 0 end #pen )
); values(?,?,?,?,?,?,?,?,?);

View File

@@ -1,6 +1,11 @@
update curso set
nombre = ?, # cname update curso set
temario = ?, # csubjects nombre=?,
servicios = ?, # cservices subnombre=?,
estado = case ? when "on" then 1 else 0 end # cen descripcion=?,
where id = ? ; # cprev imagena=?,
maestro=?,
temario=?,
servicios=?,
estado=?
where id = ? ; # cprev

View File

@@ -1,2 +1,2 @@
delete from evento where id = ? ; # eprev delete from curso_tienda where id = ? ; # eprev

View File

@@ -1,12 +1,19 @@
update evento set
lugar_id = ?, # eplace update curso_tienda set
fecha_inicio = concat(?,"-",?,"-",?), # yini - mini - dini lugar_id=?,
fecha_fin = concat(?,"-",?,"-",?), # yend - mend - dend fecha_inicio=?,
precio = ?, # cost fecha_fin=?,
promocion = ?, # promo imagen_chica=?,
promo_estado = case ? when "on" then 1 else 0 end, #pen comentario=?,
curso_id = ?, # ecourse precio=?,
imagen_chica = ?, # eimg promocion=?,
estado = case ? when "on" then 1 else 0 end # een promo_estado=?,
playera_estado=?,
spay=?,
store=?,
meses=?,
cupo=?,
curso_id=?,
estado=?
where id = ?; # eprev where id = ?; # eprev

View File

@@ -1,4 +1,4 @@
delete from lugar where id = ?; # pprev ; delete from curso_lugar where id = ?; # pprev ;

View File

@@ -1,4 +1,5 @@
update lugar set
update curso_lugar set
nombre= ?, # pname nombre= ?, # pname
direccion= ?, # paddr direccion= ?, # paddr
observacion= ?,# pobs observacion= ?,# pobs
@@ -7,6 +8,6 @@
pais= ?, # pco pais= ?, # pco
lat=?, # plat lat=?, # plat
lng=?, # plng lng=?, # plng
estado = case ? when "on" then 1 else 0 end # pen estado = ?
where id = ?; # pprev ; where id = ?; # pprev ;

View File

@@ -1,8 +1,14 @@
select select
id as "cid", id as "cid",
nombre as "cname", nombre as "cname",
subnombre as "csubname",
descripcion as "cdesc",
imagen_a as "cimga",
maestro as "cmas",
temario as "csubjects", temario as "csubjects",
servicios as "cservices" servicios as "cservices",
estado as "cestado"
from curso from curso
where id= ? ; #course ; where id= ? ; #course ;

View File

@@ -1,11 +1,8 @@
select select
"event" as "tag", "event" as "tag",
id, id,
lugar_id as "pid", lugar_id as "pid",
curso_id as "cid",
precio as "cost",
promocion as "promo",
promo_estado as "pen",
day(fecha_inicio) as "dini", day(fecha_inicio) as "dini",
month(fecha_inicio) as "mini", month(fecha_inicio) as "mini",
year(fecha_inicio) as "yini", year(fecha_inicio) as "yini",
@@ -13,9 +10,18 @@ select
month(fecha_fin) as "mend", month(fecha_fin) as "mend",
year(fecha_fin) as "yend", year(fecha_fin) as "yend",
coalesce(imagen_chica,0) as "eimg", coalesce(imagen_chica,0) as "eimg",
comentario as "comment",
precio as "cost",
promocion as "promo",
promo_estado as "pen",
playera_estado as "ten",
spay,
estore,
meses,
cupo,
curso_id as "cid",
estado as "een" estado as "een"
from evento from curso_tienda
where id= ? ; # ecourse ; where id= ? ; # ecourse ;

View File

@@ -9,7 +9,7 @@ select
lat as "plat", lat as "plat",
lng as "plng", lng as "plng",
estado as "pen" estado as "pen"
from lugar from curso_lugar
where id= ? ; # course ; where id= ? ; # course ;

View File

@@ -1,11 +1,4 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select select
"cprev" as "tag", "cprev" as "tag",
nombre as "name", nombre as "name",

View File

@@ -1,10 +1,4 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select select
"ecourse" as "tag", "ecourse" as "tag",
nombre as "name", nombre as "name",

View File

@@ -1,13 +0,0 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"emend" as "tag",
nombre as "name",
id
from mes;

View File

@@ -1,14 +0,0 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"emini" as "tag",
nombre as "name",
id
from mes;

View File

@@ -1,13 +1,6 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select select
"eplace" as "tag", "eplace" as "tag",
nombre as "name", nombre as "name",
id id
from lugar where estado=1; from curso_lugar where estado=1;

View File

@@ -1,9 +1,9 @@
select
concat(day(e.fecha_inicio)," de ",m.nombre," ",l.nombre) as "name", select
e.id as id concat(month(t.fecha_inicio)," ",day(t.fecha_inicio)," ",l.nombre) as "name",
from evento as e t.id as id
inner join lugar as l on e.lugar_id=l.id from curso_tienda as t
inner join mes as m on month(e.fecha_inicio)=m.id inner join curso_lugar as l on t.lugar_id=l.id
where e.estado=1 where t.estado=1
order by e.fecha_inicio desc; order by t.fecha_inicio desc;

View File

@@ -1,15 +1,8 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select select
"pprev" as "tag", "pprev" as "tag",
nombre as "name", nombre as "name",
id id
from lugar from curso_lugar
order by nombre asc; order by nombre asc;

View File

@@ -1,11 +1,10 @@
select select
e.id as imid, e.id as imid,
concat(day(e.fecha)," de ",m.nombre," ", year(e.fecha)) as imdate, concat(month(e.fecha)," ",day(e.fecha)," ", year(e.fecha)) as imdate,
e.nombre as imname, e.nombre as imname,
e.correo as imail, e.correo as imail,
e.texto as immsg e.texto as immsg
from entrada as e from entrada as e
inner join vuelo.mes as m on m.id=month(e.fecha)
where e.id= ? ; #imid where e.id= ? ; #imid

View File

@@ -1,3 +1,4 @@
select select
id as mid, id as mid,
concat(nombre," ",date(fecha)) as "entry" concat(nombre," ",date(fecha)) as "entry"

View File

@@ -1,4 +0,0 @@
select
a.id,a.nombre,a.existencia,a.imagen,a.precio,a.activo,a.descripcion,date(a.vigencia) as vigencia,b.nombre as entrega
from tienda as a inner join entrega as b where a.entrega_id=b.id
and a.id=?;

View File

@@ -1,4 +0,0 @@
select
correo,telefono as tel, observacion as obs,date(ultima) as ultima
from usuario where id=?;

View File

@@ -1,3 +0,0 @@
select
id,nombre,existencia,precio,activo
from tienda order by id;

View File

@@ -1,4 +0,0 @@
select
id,usuario,nombre
from usuario order by usuario;

View File

@@ -2,7 +2,14 @@
select select
date_format(t.fecha_inicio,'%Y%m') as bid, date_format(t.fecha_inicio,'%Y%m') as bid,
t.id as eeid, t.id as eeid,
concat(l.municipio,", ",l.federativa) as ciudad, case
when l.municipio = '' or l.municipio is null
then l.federativa
when l.federativa = '' or l.federativa is null
then l.municipio
else
concat(l.municipio,", ",l.federativa)
end as ciudad,
concat(l.nombre,". ") as lugar, concat(l.nombre,". ") as lugar,
l.direccion as dir, l.direccion as dir,
day(t.fecha_inicio) as dini, day(t.fecha_inicio) as dini,

View File

@@ -17,6 +17,9 @@ select
t.promo_estado as promo_estado, t.promo_estado as promo_estado,
t.playera_estado as playera_estado, t.playera_estado as playera_estado,
t.cupo as cupo, t.cupo as cupo,
t.meses as meses,
t.descuento_contado as descuento,
t.descuento_contado_estado as desc_estado,
l.nombre as lnombre, l.nombre as lnombre,
l.federativa as federativa, l.federativa as federativa,
l.pais as pais, l.pais as pais,

View File

@@ -1,9 +1,9 @@
insert into caja_evento insert into curso_caja
( (
cliente_nombre, cliente_nombre,
cliente_correo, cliente_correo,
cliente_comentario, cliente_comentario,
tienda_evento_id, curso_tienda_id,
talla_id, talla_id,
cantidad, cantidad,
monto, monto,

View File

@@ -1,8 +1,12 @@
select select
t.precio as precio, t.precio as precio,
c.nombre as nombre c.nombre as nombre,
t.meses as meses,
t.descuento_contado as descuento,
t.descuento_contado_estado as desc_estado
from from
tienda_evento as t curso_tienda as t
inner join inner join
curso as c on t.curso_id=c.id curso as c on t.curso_id=c.id
where where

View File

@@ -0,0 +1,12 @@
select
c.nombre as cnombre,
c.subnombre as csubnobre,
t.mmail as mmail,
t.fecha_inicio,
t.fecha_fin,
t.precio as cantidad
from curso_tienda as t
inner join curso as c on c.id = t.curso_id
where t.id = ? and t.estado =1
;

View File

@@ -61,10 +61,7 @@ sub intentConfirm{
# cliente_nombre,cliente_correo,cliente_comentario,tienda_evento_id,talla_id,cantidad(1),monto,etapa_id(4),entrega(3),pago_clave,plazo,fecha_pago # cliente_nombre,cliente_correo,cliente_comentario,tienda_evento_id,talla_id,cantidad(1),monto,etapa_id(4),entrega(3),pago_clave,plazo,fecha_pago
my $mq = $data->{'mq'}; my $mq = $data->{'mq'};
my $students = $data->{'students'}; my $students = $data->{'students'};
my $plan = 0; my $plan = $r->{'payment_method_options'}->{'card'}->{'installments'}->{'plan'}->{'count'} // 0;
if (defined $data->{'selected_plan'}){
$plan = $data->{'selected_plan'}->{'count'};
}
for (1..$mq){ for (1..$mq){
_write ( _write (
$data_path->child("/spay/qIntentConfirm.q")->slurp, $data_path->child("/spay/qIntentConfirm.q")->slurp,
@@ -84,6 +81,55 @@ sub intentConfirm{
return ; return ;
} }
sub notify{
my ($c,$d,$r) = @_;
my $t =shift @{ _read ($data_path->child("spay/qNotify.q")->slurp,$d->{'tid'})};
my @ra;
my %h=qw/0 na 1 CH 2 M 3 G/;
my $plazo = $r->{'payment_method_options'}->{'card'}->{'installments'}->{'plan'}->{'count'}//0;
my $cant=$r->{'amount'}/100;
my $students = $d->{'students'};
my $basetxta = "$t->{'cnombre'}
clave de pago stripe: $r->{'id'}
plazo: $plazo meses
cantidad: $cant
";
my $basetxtu = "
$t->{'cnombre'}
============================================
".$t->{'subnombre'}//""."
/////////////////////////////////////////////
";
foreach(1 .. $d->{'mq'}) {
push (@ra, ["
$basetxtu
$$students[$_ -1][0]
$t->{'mmail'}
tu clave de pago es la sigiente. Tenla a la mano para cualquier aclaración
==================================
$r->{'id'}
==================================
", " Inscripción ", $$students[$_ -1][1]]);
$basetxta .= "
Nombre: $$students[$_ -1][0]
Correo: $$students[$_ -1][1]
Telefono:$$students[$_ -1][0]
Playera:$h{$$students[$_ -1][3]}
Comentario:$$students[$_ -1][2]
=====================
";
}
push (@ra, [$basetxta,"Inscripciones",'david@chaos.foundation']);
push (@ra, [$basetxta,"Inscripciones",'benjamuga@gmail.com']);
push (@ra, [$basetxta,"Inscripciones",'mmunoz@harvbest.com']);
return @ra;
}
# Check payment user info ============== # Check payment user info ==============
# data: # data:
# =============== # ===============
@@ -95,19 +141,6 @@ sub intentConfirm{
#'students' => [ [ 'User', 'me@me.com', 'obs', 'M' ], [ 'usr2', 'mail2', 'obs', 'G' ], undef, undef, undef, undef, undef, undef, undef, undef ] #arr(10) #'students' => [ [ 'User', 'me@me.com', 'obs', 'M' ], [ 'usr2', 'mail2', 'obs', 'G' ], undef, undef, undef, undef, undef, undef, undef, undef ] #arr(10)
# =============== # ===============
sub intentSanity{
my ($c,$d)=@_;
if (defined $d->{'selected_plan'} ){
return -1 unless defined ($d->{'selected_plan'}{'type'});
return -1 unless defined ($d->{'selected_plan'}{'count'});
return -1 unless defined ($d->{'selected_plan'}{'interval'});
}
return -1 unless defined ($d->{'tid'}) && $d->{'tid'} =~ /^\d+$/ ;
return -1 unless defined ($d->{'req'}) && $d->{'req'} eq 'check';
return -1 unless defined ($d->{'payment_intent_id'});
return userDataSanity($c,$d) ;
}
sub userDataSanity{ sub userDataSanity{
my ($c,$d) = @_; my ($c,$d) = @_;
return -1 unless ( return -1 unless (
@@ -116,6 +149,7 @@ sub userDataSanity{
$d->{'mq'} =~/^\d+$/ && $d->{'mq'} =~/^\d+$/ &&
$d->{'mq'} < 10 $d->{'mq'} < 10
); );
my %h=qw(n 0 CH 1 M 2 G 3); my %h=qw(n 0 CH 1 M 2 G 3);
my $mq = $d->{'mq'}; my $mq = $d->{'mq'};
my $students = $d->{'students'}; my $students = $d->{'students'};
@@ -135,9 +169,9 @@ sub is_mail{
#============================================================================== #==============================================================================
# admin evets # admin evets
sub event_del { return _write("delete from evento where id = ?;",pop);} sub event_del { return _write("delete from curso_tienda where id = ?;",pop);}
sub course_del{ return _write("delete from curso where id = ?;",pop); } sub course_del{ return _write("delete from curso where id = ?;",pop); }
sub place_del { return _write("delete from lugar where id = ?;",pop); } sub place_del { return _write("delete from curso_lugar where id = ?;",pop); }
sub event_up{ sub event_up{
my ($self,@bind)=@_; my ($self,@bind)=@_;
@@ -165,6 +199,22 @@ sub place_ch{
} }
#============================================================================== #==============================================================================
sub courses{ return _read("select nombre as name, id from curso;")}
sub course { return shift @{_read($data_path->child("/admin/event/json/qCourse.q")->slurp,pop)}}
sub places { return _read("select nombre as name, id from curso_lugar;")}
sub place { return shift @{_read($data_path->child("/admin/event/json/qPlace.q")->slurp,pop)}}
sub events { return _read($data_path->child("/admin/event/qEprev.q")->slurp)}
sub eventa { return shift @{_read($data_path->child("/admin/event/json/qEvent.q")->slurp,pop)}}
sub eimgList{
my $dp = path('public/proc/cal/img')->make_path;
return [ map{ $_->basename} grep{/(jpg|png)$/i}@{$dp->list} ];
}
# lower level read ===================================== # lower level read =====================================

View File

@@ -30,17 +30,6 @@ sub pang_md{
return \%h; return \%h;
} }
sub calendar_monthblock {
return _read ($data_path->child("cal/q1Block.q")->slurp);
}
sub calendar_events {
return _read ($data_path->child("cal/q3Event.q")->slurp);
}
sub event{
my ($c,$id)=@_;
return shift @{ _read ($data_path->child("event/qEvent.q")->slurp,$id)};
}
sub tv_videos{ sub tv_videos{
return _read ($data_path->child("/tv/qSeries.q")->slurp); #group,name return _read ($data_path->child("/tv/qSeries.q")->slurp); #group,name
} }
@@ -57,7 +46,7 @@ sub podcast_infoHash{
#============================================================================== #==============================================================================
# Read vdg admin ============================================================== # Read vdg admin ==============================================================
sub msg_heads{ sub msg_heads{
my ($self,@bind)=@_; my ($self,@bind)=@_;
my @empty; my @empty;
my $q= $data_path->child("/admin/mensajes/qEntries.q")->slurp; my $q= $data_path->child("/admin/mensajes/qEntries.q")->slurp;
@@ -67,9 +56,9 @@ sub podcast_infoHash{
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2)) #((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect(); $dbh->disconnect();
return $h; return $h;
} }
sub msg{ sub msg{
my ($c,@bind)=@_; my ($c,@bind)=@_;
my @empty; my @empty;
my $q= $data_path->child("/admin/mensajes/json/qGetInfo.q")->slurp; my $q= $data_path->child("/admin/mensajes/json/qGetInfo.q")->slurp;
@@ -79,35 +68,7 @@ sub podcast_infoHash{
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2)) #((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect(); $dbh->disconnect();
return shift @$h; return shift @$h;
} }
sub user_heads{
return _readgrulla($data_path->child("admin/tienda/qUsers.q")->slurp);
}
sub store_heads{
return _readgrulla($data_path->child("admin/tienda/qStore.q")->slurp);
}
sub user {
return shift @{_readgrulla($data_path->child("admin/tienda/json/qUsers.q")->slurp,pop)}}
sub astore {
return shift @{_readgrulla($data_path->child("/admin/tienda/json/qStore.q")->slurp,pop)}}
sub courses{ return _read("select nombre as name, id from curso;")}
sub course { return shift @{_read($data_path->child("/admin/event/json/qCourse.q")->slurp,pop)}}
sub places { return _read("select nombre as name, id from lugar;")}
sub place { return shift @{_read($data_path->child("/admin/event/json/qPlace.q")->slurp,pop)}}
sub months { return _read("select nombre as name, id from mes;")};
sub events { return _read($data_path->child("/admin/event/qEprev.q")->slurp)}
sub eventa { return shift @{_read($data_path->child("/admin/event/json/qEvent.q")->slurp,pop)}}
# sub eimgList{ return [get_names("public/home/cal/img/")] }
sub eimgList{
my $dp = path('public/home/cal/img')->make_path;
return [ map{ $_->basename} grep{/(jpg|png)$/i}@{$dp->list} ];
}
#============================================================================== #==============================================================================
# Write vdg user ============================================================== # Write vdg user ==============================================================
@@ -116,7 +77,7 @@ sub contact{
my $q="insert into entrada (nombre,correo,pagina,texto,fecha) values(?,?,?,?,now() )" ; my $q="insert into entrada (nombre,correo,pagina,texto,fecha) values(?,?,?,?,now() )" ;
my @a=@_; my @a=@_;
#simple method to ignore spam #simple method to ignore spam
return _writemsg($q,@a) unless $a[3]=~m/http|website|\<a|feedback|forms|suscribe|advertise|newsletter|promotion|Madam|Sir/; return _writemsg($q,@a) unless $a[3]=~m/http|website|\<a|feedback|forms|suscribe|investment|funding|site|company|advertise|newsletter|promotion|Madam|Sir/;
return 0; return 0;
} }
#============================================================================== #==============================================================================
@@ -127,35 +88,6 @@ sub umod{
return _write($q,@_); return _write($q,@_);
} }
sub event_del { return _write("delete from evento where id = ?;",pop);}
sub course_del{ return _write("delete from curso where id = ?;",pop); }
sub place_del { return _write("delete from lugar where id = ?;",pop); }
sub event_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qEup.q")->slurp,@bind);
}
sub course_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qCup.q")->slurp,@bind);
}
sub place_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qPup.q")->slurp,@bind);
}
sub event_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qEup.q")->slurp,@bind);
}
sub course_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qCup.q")->slurp,@bind);
}
sub place_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qPup.q")->slurp,@bind);
}
#============================================================================== #==============================================================================
#ayudas ===================================== #ayudas =====================================

View File

@@ -2,7 +2,7 @@ package Dojo::Support;
use strict; use strict;
use warnings; use warnings;
use Exporter 'import'; use Exporter 'import';
our @EXPORT = qw/ mtxt commify month_num2txt log dmph merge_hash load_module get_names /; our @EXPORT = qw/send_mail mtxt commify month_names month_num2txt log dmph merge_hash load_module get_names /;
use Mojo::Base 'Mojolicious'; use Mojo::Base 'Mojolicious';
use File::Basename; use File::Basename;
@@ -18,6 +18,11 @@ sub log{
$log->debug("============ ".shift." ==========="); $log->debug("============ ".shift." ===========");
} }
sub _log{
my $log = Mojo::Log->new;
$log->debug("============ ".shift." ===========");
}
sub get_names{ sub get_names{
my $dir = shift; my $dir = shift;
my @file_name; my @file_name;
@@ -45,6 +50,10 @@ sub month_num2txt{
return ("enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre" =~ m/\w+/g)[shift (@_) -1]; return ("enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre" =~ m/\w+/g)[shift (@_) -1];
} }
sub month_names{
return qw /enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre/;
}
sub mtxt { sub mtxt {
my ($di, $mi, $df, $mf)=@_; # dini,mini,dfin,mfin my ($di, $mi, $df, $mf)=@_; # dini,mini,dfin,mfin
my $txt; my $txt;
@@ -89,5 +98,10 @@ sub dmph{
return $y; return $y;
} }
sub send_mail{ #msg header mail
system( 'echo "'.shift.'" | mutt -s '.shift.' '.shift.' &');
_log("mail sent");
return 0;
}
1; 1;

View File

@@ -76,6 +76,7 @@ div.update{
article.edit input[type=submit]{ article.edit input[type=submit]{
margin:15px; margin:15px;
} }
div#cimg,
div#esimg{ div#esimg{
height:180px; height:180px;
width:180px; width:180px;

View File

@@ -1,6 +1,6 @@
d3.select("li#evento").style("background-color","#cedeef"); d3.select("li#evento").style("background-color","#cedeef");
var li = d3.select("article.label","ul").selectAll("li"); var li = d3.select("article.label","ul").selectAll("li");
var img_path = "/home/cal/img/"; var img_path = "/proc/cal/img/";
var json_path = "/admin/json/"; var json_path = "/admin/json/";
/* menu hide and show edit window*/ /* menu hide and show edit window*/
li.on("click",function(){ li.on("click",function(){
@@ -46,10 +46,21 @@ d3.select("select#cprev").on("change",function(){
d3.json(json_path+"course/"+cprev_id ,function(d){ d3.json(json_path+"course/"+cprev_id ,function(d){
if(d!=undefined){if(d.cid != 0){ if(d!=undefined){if(d.cid != 0){
d3.select("input#cname").attr("value",d.cname); d3.select("input#cname").attr("value",d.cname);
d3.select("input#csubname").attr("value",d.csubname);
d3.select("textarea#cdesc").text(d.cdesc);
d3.select("input#cmas").attr("value",d.mas);
d3.select("textarea#csubjects").text(d.csubjects); d3.select("textarea#csubjects").text(d.csubjects);
d3.select("textarea#cservices").text(d.cservices); d3.select("textarea#cservices").text(d.cservices);
}} }); }); }} }); });
function updateImagea(){
var iname=d3.select("select#cimga").node().value;
if(iname != 0){
d3.select("div#cimg").style("background-image","url("+img_path+iname+")");}
else{ d3.select("div#cimg").style("background-image","none"); }
}
d3.select("select#cimga").on("change",updateImagea);
/*preload form content for place*/ /*preload form content for place*/
d3.select("select#pprev").on("change",function(){ d3.select("select#pprev").on("change",function(){
var pprev_id=d3.select("select#pprev").node().value; var pprev_id=d3.select("select#pprev").node().value;

View File

@@ -29,7 +29,6 @@ min-height: 30px;
margin-top: 6px; margin-top: 6px;
} }
#gpass{ #gpass{
color:white;
font-size:1.5em; font-size:1.5em;
} }
section.radio{ section.radio{

83
public/global/nav/bcast.js Executable file
View File

@@ -0,0 +1,83 @@
window.onload = function(){
radioUpdate();
function radioUpdate(){
d3.json(radio_server +"/status-json.xsl")
.timeout(10000)
.get(function(e,d){
if(e !=undefined){
console.warn("sin conxion");
offline();}
else{
if(d.icestats.source!=undefined){
if(d.icestats.source.listenurl == webm_listen_url){
console.log("transmitiendo video");
onlinev(d); }
else if (d.icestats.source.listenurl == radio_listen_url){
console.log("transmitiendo radio");
onliner(d); }
else if (d.icestats.source.listenurl == radiop_listen_url){
console.log("transmitiendo radio");
onlinerp(d); }
else {
console.warn("otro canal");
offline(); }}
else {
console.warn("fuera de línea");
offline();
}
} }); };
function dataUpdate(){
d3.json(radio_server+"/status-json.xsl")
.timeout(10000)
.get(function(e,d){
if(e !=undefined){ console.warn("sin datos radio"); }
else{
if(d.icestats.source!=undefined){
if(d.icestats.source.listenurl == listen_url ){
d3.select("#now").text(d.icestats.source.title);
}}}
d3.select("#ra").transition().on("end",dataUpdate).delay(60000);
});
};
function offline(){
d3.selectAll("article.broadcast").style("display","none")
d3.select("article.broadcast").transition().on("end",radioUpdate).delay(90000);
d3.selectAll("a.radiolink").style("display", "display");
d3.selectAll("a.radiolinkp").style("display", "none");
};
function onlinev(d){
d3.selectAll("article.broadcast")
.style("display","block");
d3.selectAll("article.broadcast,p.broadcast")
.on("click",function(){window.location="bcast";});
dataUpdate();
}
function onliner(d){
d3.selectAll(".broadcast")
.style("display","block");
d3.selectAll("article.broadcast,p.broadcast")
.on("click",function(){window.location="radio";});
d3.selectAll("a.radiolink").style("display", "display");
d3.selectAll("a.radiolinkp").style("display", "none");
dataUpdate();
}
function onlinerp(d){
d3.selectAll(".broadcast")
.style("display","block");
d3.selectAll("article.broadcast,p.broadcast")
.on("click",function(){window.location="radiop";});
d3.selectAll("a.radiolinkp").style("display", "display");
d3.selectAll("a.radiolink").style("display", "none");
dataUpdate();
}
}

View File

@@ -17,6 +17,9 @@ window.onload = function(){
else if (d.icestats.source.listenurl == radio_listen_url){ else if (d.icestats.source.listenurl == radio_listen_url){
console.log("transmitiendo radio"); console.log("transmitiendo radio");
onliner(d); } onliner(d); }
else if (d.icestats.source.listenurl == radiop_listen_url){
console.log("transmitiendo radio");
onlinerp(d); }
else { else {
console.warn("otro canal"); console.warn("otro canal");
offline(); }} offline(); }}
@@ -34,7 +37,7 @@ window.onload = function(){
if(e !=undefined){ console.warn("sin datos radio"); } if(e !=undefined){ console.warn("sin datos radio"); }
else{ else{
if(d.icestats.source!=undefined){ if(d.icestats.source!=undefined){
if(d.icestats.source.listenurl == listen_url ){ if(d.icestats.source.listenurl == radio_listen_url ){
d3.select("#now").text(d.icestats.source.title); d3.select("#now").text(d.icestats.source.title);
}}} }}}
@@ -63,5 +66,13 @@ window.onload = function(){
dataUpdate(); dataUpdate();
} }
function onlinerp(d){
d3.selectAll(".broadcast")
.style("display","block");
d3.selectAll("article.broadcast,p.broadcast")
.on("click",function(){window.location="radiop";});
dataUpdate();
}
} }

View File

@@ -129,6 +129,12 @@ div#cover{
display:block; display:block;
font-weight: bold; font-weight: bold;
} }
label.nobold {
margin:8px 0;
font-weight: normal;
font-size:1.1em;
}
.form-style-1 input[type=text], .form-style-1 input[type=text],
.form-style-1 input[type=date], .form-style-1 input[type=date],
.form-style-1 input[type=datetime], .form-style-1 input[type=datetime],

View File

@@ -1,5 +1,6 @@
/* some format to numbers */ /* some format to numbers */
var it=1; var it=1;
var pl = 0; //instalment plan index
var students = new Array(10); var students = new Array(10);
/* price format (comas) */ /* price format (comas) */
@@ -22,56 +23,6 @@ var cform = document.getElementById('cform');
var ccard = document.getElementById('ccard'); var ccard = document.getElementById('ccard');
/* ====================== */ /* ====================== */
/* back button ========== */
cinfob.addEventListener('click', function(ev){
it --;
atof();
if (it==1){cinfob.hidden=true;}
});
/* ====================== */
/* fwd button============ */
cinfo.addEventListener('click', function(ev){
if (
(document.forms["cform"]["mname"].value =="") ||
(document.forms["cform"]["mmail"].value =="")
){console.log("form incomplete");}
else if ( mq.value > it) {
students[it - 1]=ftoa();
it ++;
if(typeof students[it - 1]!== "undefined"){ atof(); }
cinfob.hidden=false;
}
else {
students[it - 1]=ftoa();
document.getElementById('cover').hidden = false;
document.getElementById("cover").style.opacity = "0.8";
fetch('/spay/userCheck', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ students:students, req:"precheck", mq:mq.value})
})
.then((response) => response.json())
.then((data) => {
if(data.userst == "0"){
cform.hidden = true;
ccard.hidden = false;
}
else{ alert("hay un error en los datos de alumnos"); }
})
.catch((error) => {
console.error('Error:', error);
});
document.getElementById("cover").style.opacity = "0";
setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
}
});
/* ====================== */
/* save form to array=== */ /* save form to array=== */
function ftoa(){ function ftoa(){
var rad; var rad;
@@ -104,9 +55,93 @@ function atof(){
} }
/* ====================== */ /* ====================== */
/* back button ========== */
cinfob.addEventListener('click', function(ev){
it --;
atof();
if (it==1){cinfob.hidden=true;}
});
/* ====================== */
/* fwd button============ */
cinfo.addEventListener('click', function(ev){
if (
(document.forms["cform"]["mname"].value =="") ||
(document.forms["cform"]["mmail"].value =="")
){console.log("form incomplete");}
else if ( mq.value > it) {
students[it - 1]=ftoa();
it ++;
if(typeof students[it - 1]!== "undefined"){ atof(); }
cinfob.hidden=false;
}
else {
students[it - 1]=ftoa();
document.getElementById('cover').hidden = false;
document.getElementById("cover").style.opacity = "0.8";
fetch('/spay/userCheck', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ students:students, req:"precheck", mq:mq.value})
})
.then((response) => response.json())
.then((data) => {
if(data.userst == "0"){
cform.hidden = true;
if(meses==0){ ccard.hidden = false;}
else{
cplan.hidden = false;
var multcc = calc_price();
document.getElementById('gtc').innerHTML=multcc.toLocaleString();
}
}
else{ alert("hay un error en los datos de alumnos"); }
})
.catch((error) => {
console.error('Error:', error);
});
document.getElementById("cover").style.opacity = "0";
setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
}
});
var pl = document.forms["plform"]["pl"];
document.getElementById("timebutton").addEventListener('click', function(ev){
cplan.hidden = true;
ccard.hidden = false;
});
function calc_price(){
if(desc_estado == 1 && descuento > 0) {
return (mq.value*cu*(1 - (descuento/100) ) );
}
else{ return cu*mq.value;}
};
var multc;
for (var i = 0; i < pl.length; i++) {
pl[i].addEventListener('change', function() {
if (this.value == 0 ) {
multc = calc_price();
document.getElementById('gtc').innerHTML=multc.toLocaleString();
}
else {
multc = cu*mq.value;
document.getElementById('gtc').innerHTML=multc.toLocaleString();
}
});
};
/* ====================== */
/* stripe magic begins here */ /* stripe magic begins here */
/* ====================================================== */ /* ====================================================== */
var stripe = Stripe('pk_test_wxFt0GhsUK2YsprkLXa2iFrQ00nfjAeucu'); let availablePlans = [0,3,6,9];
//var stripe = Stripe('publc_key');
var elements = stripe.elements(); var elements = stripe.elements();
var cardElement = elements.create('card', { var cardElement = elements.create('card', {
style: { style: {
@@ -148,87 +183,38 @@ cardButton.addEventListener('click', function(ev) {
.then(function(result) { .then(function(result) {
// Show error in payment form // Show error in payment form
if (result.error) { if (result.error) {
document.getElementById("cover").style.opacity = "0"; errorh("connection to stripe failed");
setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
console.log("network error");
} }
// Otherwise send paymentMethod.id to your server (see Step 2) // Otherwise send paymentMethod.id to your server (see Step 2)
else { else {
fetch('/spay/intentCreate', { fetch('/spay/intentCreate', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ payment_method_id: result.paymentMethod.id, req:"precheck", mq:mq.value, tid:tid}) body: JSON.stringify({
payment_method_id: result.paymentMethod.id,
req:"precheck",
mq:mq.value,
tid:tid,
students:students,
pl:pl.value
})
}) })
.then(function(result) { .then(function(result) {
// Handle server response (see Step 3) result.json().then(function(json) { end_message(json); })
result.json().then(function(json) { handleInstallmentPlans(json); })
}); });
} }
}); });
}); });
///*presenta los planes de pago */ const end_message = async (response) => {
const selectPlanForm = document.getElementById('installment-plan-form');
let availablePlans = [];
const handleInstallmentPlans = async (response) => {
if (response.error) { // Show error from server on payment form
console.log("preauth response error");
}
else {
// si avaliable plans es indefinido, se queda alli con el cover
// Store the payment intent ID.
document.getElementById('payment-intent-id').value = response.intent_id;
availablePlans = response.available_plans;
// Show available installment options
availablePlans.forEach((plan, idx) => {
const newInput = document.getElementById('immediate-plan').cloneNode();
newInput.setAttribute('value', idx);
newInput.setAttribute('id', '');
const label = document.createElement('label');
label.appendChild(newInput);
label.appendChild(
document.createTextNode(`${plan.count} meses`),
);
selectPlanForm.appendChild(label);
});
document.getElementById('ccard').hidden = true;
document.getElementById('cplan').hidden = false;
}
document.getElementById("cover").style.opacity = "0";
setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
};
// termina la transacción
const confirmButton = document.getElementById('confirm-button');
confirmButton.addEventListener('click', async (ev) => {
document.getElementById('cover').hidden = false;
document.getElementById("cover").style.opacity = "0.8";
const selectedPlanIdx = selectPlanForm.installment_plan.value;
const selectedPlan = availablePlans[selectedPlanIdx];
const intentId = document.getElementById('payment-intent-id').value;
const response = await fetch('/spay/intentConfirm', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
payment_intent_id: intentId,
selected_plan: selectedPlan,
req:"check",
students:students,
mq:mq.value,
tid:tid
}),
});
const responseJson = await response.json();
// Show success / error response.
document.getElementById("cover").style.opacity = "0"; document.getElementById("cover").style.opacity = "0";
setTimeout(function(){ document.getElementById('cover').hidden = true;},500); setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
document.getElementById('cmsg').hidden = false; document.getElementById('cmsg').hidden = false;
document.getElementById('cplan').hidden = true; document.getElementById('ccard').hidden = true;
var message; var message;
if (responseJson.status === "succeeded" && selectedPlan !== undefined) { if (response.status === "succeeded" && response.pl !== null ) {
message = `¡Tu compra a ${ message = `¡Tu compra a ${
selectedPlan.count response.pl.count
} meses sin intereses se ha realizado con éxito! `; } meses sin intereses se ha realizado con éxito! `;
} else if (responseJson.status === "succeeded") { } else if (responseJson.status === "succeeded") {
message = "¡Tu compra se ha realizado con éxito!"; message = "¡Tu compra se ha realizado con éxito!";
@@ -238,5 +224,20 @@ confirmButton.addEventListener('click', async (ev) => {
} }
document.getElementById("status-message").innerText = message; document.getElementById("status-message").innerText = message;
}); };
function errorh(msg){
document.getElementById("cover").style.opacity = "0";
setTimeout(function(){ document.getElementById('cover').hidden = true;},500);
cform.hidden = true;
cplan.hidden = true;
cform.hidden = true;
document.getElementById('cmsg').hidden = false;
console.log(msg);
var message = `Tenemos un problema para verificar tus datos.
Por favor intenta de nuevo o comunícate con nosotros`;
document.getElementById("status-message").innerText = message;
tid=0;
}

View File

@@ -1,10 +1,13 @@
% stash css=>["/admin/admin.css","/admin/event/event.css"]; % stash css=>["/admin/admin.css","/admin/event/event.css"];
% stash js=>["//admin/event/event.js"]; % stash js=>["/admin/event/event.js"];
<section class="name" flex> <article class="user"> <section class="name" flex>
<article class="user">
<p class="title">Editar Eventos</p> <p class="title">Editar Eventos</p>
</article> </section> </article>
</section>
<section class="event flex"> <section class="event flex">
<article class="label"> <article class="label">
<ul> <ul>
<li id="evento" value="event">Evento</li> <li id="evento" value="event">Evento</li>
@@ -14,8 +17,9 @@
</article> </article>
<article class="edit"> <article class="edit">
<!-- Evento ============================================================== --> <!-- Evento ============================================================== -->
<div class="ehide" id="event"> <form action="/admin/eventos/e" method="POST"> <div class="ehide" id="event">
<form id="fev" action="/admin/eventos/e" method="POST">
<div class="flex field"> <div class="flex field">
<label>Curso</label> <label>Curso</label>
<select id="ecourse" name="ecourse"> <select id="ecourse" name="ecourse">
@@ -36,21 +40,21 @@
<label>Fecha inicio</label> <!-- dropdown --> <label>Fecha inicio</label> <!-- dropdown -->
<input id="dini" type="number" min="1" max="31" name="dini" value="1"/> <input id="dini" type="number" min="1" max="31" name="dini" value="1"/>
<select id="mini" name="mini"> <select id="mini" name="mini">
<% map{ %> <% foreach(1 .. 12){ %>
<option value="<%= $_->{'id'} %>"><%= $_->{'name'} %></option> <option value="<%= $_ %>"><%= ${stash('months')}[$_ -1] %> </option>
<% } %><% (@{stash('months')}) %><% if defined(stash('months')); %> <% } %>
</select> </select>
<input id="yini" type="number" min="2019" max="2050" name="yini" value="2019"/> <input id="yini" type="number" min="2020" max="2050" name="yini" value="2020"/>
</div> </div>
<div class="flex field"> <div class="flex field">
<label>Fecha fin</label> <label>Fecha fin</label>
<input id="dend" type="number" min="1" max="31" name="dend" value="1"/> <input id="dend" type="number" min="1" max="31" name="dend" value="1"/>
<select id="mend" name="mend"> <select id="mend" name="mend">
<% map{ %> <% foreach(1 .. 12){ %>
<option value="<%= $_->{'id'} %>"><%= $_->{'name'} %></option> <option value="<%= $_ %>"><%= ${stash('months')}[$_ -1] %> </option>
<% } %><% (@{stash('months')}) %><% if defined(stash('months')); %> <% } %>
</select> </select>
<input id="yend" type="number" min="2019" max="2050" name="yend" value="2019"/> <input id="yend" type="number" min="2020" max="2050" name="yend" value="2020"/>
</div> </div>
<div class="flex field"> <div class="flex field">
<label>Costo</label> <input id="cost" type="text" name="cost"/> <label>Costo</label> <input id="cost" type="text" name="cost"/>
@@ -69,6 +73,28 @@
</select> </select>
<div id=esimg></div> <div id=esimg></div>
</div> </div>
<div class="flex field">
<label>¿con pago en linea?</label><input type="checkbox" checked="checked" id="spay" name="spay"/>
</div>
<div class="flex field">
<label>¿incluye playera?</label><input type="checkbox" id="ten" name="ten"/>
</div>
<div class="flex field">
<label>¿es público?</label><input type="checkbox" checked="checked" id="estore" name="estore"/>
</div>
<div class="flex field">
<label>Pago a meses max:</label><input id="meses" type="number" min="0" max="18" name="meses" value="0"/>
</div>
<div class="flex field">
<label>Cupo</label><input id="meses" type="number" min="0" max="500" name="meses" value="0"/>
</div>
<div class="flex field">
<label>Comentario</label>
<textarea form="fev" id="comment" name="comment"></textarea>
</div>
<div class="flex field"> <div class="flex field">
<label>Existente</label> <label>Existente</label>
<select id="eprev" name="id"> <select id="eprev" name="id">
@@ -84,12 +110,33 @@
<label>Habilitar</label> <label>Habilitar</label>
<input id="een" type="checkbox" checked="checked" name="een" > <input id="een" type="checkbox" checked="checked" name="een" >
</div> </div>
</form> </div> </form>
<!-- Curso ================================================================ --> </div>
<div class="ehide" id="course"> <form id="fcourse" action="/admin/eventos/c" method="POST"> <!-- Curso ================================================================ -->
<div class="ehide" id="course">
<form id="fcourse" action="/admin/eventos/c" method="POST">
<div class="flex field"> <div class="flex field">
<label>Nombre</label> <label>Nombre</label>
<input id="cname" type="text" name="cname"/> <input id="cname" type="text" name="cname"/>
</div> <div class="flex field">
<label>Subnombre</label>
<input id="csubname" type="text" name="csubname"/>
</div> <div class="flex field">
<label>Descripcion</label>
<textarea form="fcourse" id="cdesc" name="cdesc"></textarea>
</div> <div class="flex field">
<label>Maestro</label>
<input id="cmas" type="text" name="cmas"/>
<div class="flex field">
<label>Imagen</label>
<select id="cimga" name="cimga">
<option value="0" selected> -- Elegir imagen -- </option>
<% map{ %>
<option value="<%= $_ %>"><%= $_ %></option>
<% } %><% (@{stash('img')}) %><% if defined(stash('img')); %>
</select>
<div id=cimg></div>
</div>
</div> <div class="flex field"> </div> <div class="flex field">
<label>Temario</label> <label>Temario</label>
<textarea form="fcourse" id="csubjects" name="csubjects"></textarea> <textarea form="fcourse" id="csubjects" name="csubjects"></textarea>
@@ -110,9 +157,11 @@
<label>Habilitar</label> <label>Habilitar</label>
<input type="checkbox" checked="checked" id="cen" name="cen" > <input type="checkbox" checked="checked" id="cen" name="cen" >
</div> </div>
</form> </div> </form>
<!-- Lugar ================================================================ --> </div>
<div class="ehide" id="place"><form action="/admin/eventos/p" method="POST"> <!-- Lugar ================================================================ -->
<div class="ehide" id="place">
<form action="/admin/eventos/p" method="POST">
<div class="flex field"> <div class="flex field">
<label>Nombre</label><input type="text" id= "pname" name="pname"> <label>Nombre</label><input type="text" id= "pname" name="pname">
</div> <div class="flex field"> </div> <div class="flex field">
@@ -143,6 +192,9 @@
<label>Habilitar</label> <label>Habilitar</label>
<input id="pen" type="checkbox" checked="checked" name="pen" > <input id="pen" type="checkbox" checked="checked" name="pen" >
</div> </div>
</form> <div class="mapa"></div> </form>
<div class="mapa"></div>
</div>
</article> </article>
</section> </section>

View File

@@ -66,5 +66,7 @@
<script> <script>
const webm_listen_url="<%= $config->{webm_server_name} %>"; const webm_listen_url="<%= $config->{webm_server_name} %>";
const radio_listen_url="<%= $config->{radio_server_name} %>"; const radio_listen_url="<%= $config->{radio_server_name} %>";
const radiop_listen_url="<%= $config->{radiop_server_name} %>";
const radio_server="<%= $config->{radio_server} %>"; const radio_server="<%= $config->{radio_server} %>";
const radiop_server="<%= $config->{radiop_server} %>";
</script> </script>

View File

@@ -9,6 +9,7 @@
<div class="tnum"><p>(55) 5412 9940</p></div> <div class="tnum"><p>(55) 5412 9940</p></div>
</article> </article>
<article class="nav"> <article class="nav">
<a class="nav" href="https://online.vuelodegrulla.com"><p>Curso Virtual</p></a>
<a class="nav" href="/cal"><p>Calendario</p></a> <a class="nav" href="/cal"><p>Calendario</p></a>
<a class="nav" href="/radio"><p>Radio</p></a> <a class="nav" href="/radio"><p>Radio</p></a>
<a class="nav" href="/tv"><p>Vuelo de Grulla TV</p></a> <a class="nav" href="/tv"><p>Vuelo de Grulla TV</p></a>
@@ -32,6 +33,7 @@
<div class="tnum"><p>(55)5412 9940</p></div> <div class="tnum"><p>(55)5412 9940</p></div>
</article> </article>
<article class="nav"> <article class="nav">
<a class="nav" href="https://online.vuelodegrulla.com"><p>Curso Virtual</p></a>
<a class="nav" href="/cal"><p>Calendario</p></a> <a class="nav" href="/cal"><p>Calendario</p></a>
<a class="nav" href="/radio"><p>Radio</p></a> <a class="nav" href="/radio"><p>Radio</p></a>
<a class="nav" href="/tv"><p>Vuelo de Grulla TV</p></a> <a class="nav" href="/tv"><p>Vuelo de Grulla TV</p></a>

View File

@@ -2,6 +2,7 @@
<section id="saside" class="aside"> <section id="saside" class="aside">
<aside class="aside"> <aside class="aside">
<p id="pclose" class="close">Cerrar</p> <p id="pclose" class="close">Cerrar</p>
<a class="aside" href="https://online.vuelodegrulla.com"><p class="aside">Curso Virtual</p></a>
<a class="aside" href="/pang"><p class="aside">Nuestra escuela</p></a> <a class="aside" href="/pang"><p class="aside">Nuestra escuela</p></a>
<a class="aside" href="/cal"><p class="aside">Calendario</p></a> <a class="aside" href="/cal"><p class="aside">Calendario</p></a>
<a class="aside" href="/contact"><p class="aside">Contacto</p></a> <a class="aside" href="/contact"><p class="aside">Contacto</p></a>

46
templates/home/radiop.html.ep Executable file
View File

@@ -0,0 +1,46 @@
% stash css=>["/home/radio/radio.css"];
% stash js=>["/home/radio/link.js","/home/radio/radio.js"];
<section class="flex title">
<article class="title"> <p>Radio Vuelo de grulla</p> </article>
</section>
<section class="flex uname">
<article class="uname"><p> <%= $nick %></p></article>
</section>
<section class="flex rmod">
<article><p id="rmod"> <%= $rmod %></p> </article>
</section>
<section class="flex logout"> <article class="logout">
<a href=" logout "><p id="logout"> Salir </p></a>
</article> </section>
<section class="flex info">
<article class="online">
<p>Estás escuchando a</p>
<p id="prof"></p>
</article>
<article class="offline">
<p>Todavía no comenzamos</p>
<p>Por favor espera unos minutos</p>
</article>
<article class="spot">
<div class="spot" id="spot"></div>
<div id="clink" class="chat">Entra al Chat</div>
</article>
</section>
<section class="flex radio"><article class="radio">
<p id="now"></p>
<audio id="ra" controls="controls" preload="none" ></audio>
</article> </section>
<section class="flex chat"><article>
</section></article> </section>
<script>
const nick="<%= $nick %>";
const radio_server="<%= $config->{radio_server} %>";
const listen_url="<%= $config->{radiop_server_name} %>";
const channel="<%= $config->{radiop_channel} %>";
</script>

View File

@@ -1,7 +1,7 @@
%stash css=>["/proc/spay/storep.css"]; %stash css=>["/proc/spay/storep.css"];
%stash js => ["/proc/spay/stripe.js"]; %stash js => ["/proc/spay/stripe.js"];
<script src="https://js.stripe.com/v3/"></script> <script src="https://js.stripe.com/v3/"></script>
<script type="text/javascript"> var cu=<%= $precio %>; var tid=<%= $tid %></script>
<section class="ibottom"> <section class="ibottom">
<p class="nombre"><%= $nombre %></p> <p class="nombre"><%= $nombre %></p>
<p class="tit"><%= $municipio %>, <%= $federativa %></p> <p class="tit"><%= $municipio %>, <%= $federativa %></p>
@@ -25,12 +25,12 @@
<% elsif ($cupo == 0) { =%> <p class="eldep">¡Agotado!</p> <% } =%> <% elsif ($cupo == 0) { =%> <p class="eldep">¡Agotado!</p> <% } =%>
<form onSubmit="return false" id="cform"> <form onSubmit="return false" id="cform">
<p class="precio">Costo por asistente: $<span id='cu'></span> pesos</p> <p class="precio">Costo por asistente: $<span id='cu'></span> pesos</p>
<ul class="form-style-1"> <ul class="form-style-1">
<li> <li>
<label>Numero de asistentes</label> <label>Numero de asistentes</label>
<input type="number" min=1 max=10 name="mq" class="field-mini" value=1 /> <input type="number" min=1 max=10 name="mq" class="field-mini" value=1 />
<span id="anum"></span>
</li> </li>
<li> <li>
<label>Nombre Completo <span class="required">*</span></label> <label>Nombre Completo <span class="required">*</span></label>
@@ -60,6 +60,28 @@
</ul> </ul>
</form> </form>
<div id="cplan" class="plan" hidden >
<p class="plan">Planes de pago</p>
<form onSubmit="return false" class="form-style-1" id="plform">
<label class="nobold" for="ra">
<input name="pl" id="pl" type="radio" value="0" checked>
Pago de contado
</label>
<label class="nobold" for="rb">
<input name="pl" id="pl" type="radio" value="1">3 meses
</label>
<label class="nobold" for="rc">
<input name="pl" id="pl" type="radio" value="2">6 meses
</label>
<label class="nobold" for="rd">
<input name="pl" id="pl" type="radio" value="3">9 meses
</label>
<input id="payment-intent-id" type="hidden" />
</form>
<p class="total">Total = $ <span id='gtc' ></span> pesos </p>
<button class="fbutton" id="timebutton">Confirmar</button>
</div>
<div id="ccard" class="cardinfo" hidden=true> <div id="ccard" class="cardinfo" hidden=true>
<p class="card">Datos de la tarjeta</p> <p class="card">Datos de la tarjeta</p>
<ul class="form-style-1" id="details"> <ul class="form-style-1" id="details">
@@ -78,20 +100,6 @@
</ul> </ul>
</div> </div>
<div id="cplan" class="plan" hidden>
<p class="plan">Planes de pago</p>
<div id="plans" >
<form id="installment-plan-form" >
<label>
<input id="immediate-plan" type="radio" name="installment_plan" value="-1" />
Un solo pago
</label>
<input id="payment-intent-id" type="hidden" />
</form>
<button class="fbutton" id="confirm-button">Confirmar Pago</button>
</div>
</div>
<div id="cmsg" class="message" hidden> <div id="cmsg" class="message" hidden>
<div id="result"> <div id="result">
<p id="status-message"></p> <p id="status-message"></p>
@@ -102,3 +110,13 @@
</section> </section>
<section class="bdat"> </section> <section class="bdat"> </section>
<script type="text/javascript">
var stripe = Stripe('<%= $stripe_sk_public %>');
var cu=<%= $precio %>;
var tid=<%= $tid %>;
var meses=<%= $meses %>;
var descuento=<%= $descuento %>;
var desc_estado=<%= $desc_estado %>;
</script>

View File

@@ -1,4 +1,4 @@
%stash css=>["/users/login/formu.css"]; %stash css=>["/users/login/formt.css"];
<section class="hero"> <section class="hero">
<article class="login"> <article class="login">
<p>Bienvenido</p> <p>Bienvenido</p>