sharee.bike/copri4/shareeapp-operator/src/Tpl/AccountSubmenu.pm

176 lines
6.6 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
package AccountSubmenu;
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
use strict;
use warnings;
use POSIX;
use CGI ':standard';
use Lib::Config;
use Mod::Buttons;
use Mod::Libenz;
use Mod::Libenzdb;
use Mod::DBtank;
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
#Template
sub tpl(){
my $self = shift;
my $node_meta = shift;
my $users_dms = shift || "";
my $mode = shift || "";
my $varenv = shift;
my $users_sharee = shift || "";
my $return = shift || "";
my $q = new CGI;
my $cf = new Config;
my $but = new Buttons;
my $lb = new Libenz;
my $db = new Libenzdb;
my $dbt = new DBtank;
my $lang = "de";
my $script = $q->script_name();
my $path_info = $q->path_info();
my $path = $path_info;
#with meta_host,
if("$varenv->{metahost}"){
$path = "$script" . "$path_info";
$script="";
}
my $session="";
if($R::sessionid && length($R::sessionid) > 20){
$session = "?sessionid=$R::sessionid";
}
my @viewsel = split /\//,$1 if($path =~ /^\/(.*)/);
#my $coo = $q->cookie(-name=>'domcookie') || $R::sessionid || "";
my $coo = $R::authcookie || $R::sessionid || "";
#my $merchant_id = "";
#$merchant_id = $coo if($coo && length($coo) <= 10);
#$merchant_id = $1 if($coo =~ /_(\w+)$/);
my $bgcolor1 = "009899";#sharee
2022-03-24 07:25:20 +01:00
my $hgcolor1 = "c0c0c0";#silver
my $fgcolor1 = "ffffff";#white
2021-12-30 12:05:56 +01:00
#my $bgcolor1 = "e2001a";
$bgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{bgcolor1} if($dbt->{website}->{$varenv->{syshost}}->{bgcolor1});
2022-03-24 07:25:20 +01:00
$hgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{hgcolor1} if($dbt->{website}->{$varenv->{syshost}}->{hgcolor1});
$fgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{fgcolor1} if($dbt->{website}->{$varenv->{syshost}}->{fgcolor1});
2021-12-30 12:05:56 +01:00
#$bgcolor1 = $dbt->{merchant_ids}->{$merchant_id}->{bgcolor1} if($merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{bgcolor1});
$bgcolor1 = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{bgcolor1} if($dbt->{merchant_ids}->{$varenv->{merchant_id}}->{bgcolor1});
#payable check
my $payable_check=0;
if(($users_sharee->{int03} == 1 && $users_sharee->{ct_name} =~ /\w{2}-\d+/) || ($users_sharee->{int03} == 2 && length($users_sharee->{ct_name}) >= 19)){
$payable_check=1;
}
my $node1 = $db->collect_node($node_meta->{parent_id},$lang,"1");
2022-04-02 20:28:45 +02:00
my $margin_top = "0";
if($dbt->{website}->{$varenv->{syshost}}->{layout} eq "iframe"){
$margin_top = "40px";
}
2022-03-23 07:20:56 +01:00
#bootstrap 5 with standalone bayern
2022-03-30 13:06:39 +02:00
if(1==1){
2022-03-23 07:20:56 +01:00
#subMenue--------
print "<style>
ul#AccNavi {
position:relative;
2022-04-02 20:28:45 +02:00
margin-top:$margin_top;
2022-03-23 07:20:56 +01:00
display:flex;
margin-left: -32px;
}
ul#AccNavi li {
list-style: none;
display: inline;
margin-right:20px;
}
ul#AccNavi li a {
display:flex;
text-align:center;
align-itmes;center;
justify-content:center;
transition: all 0.3s ease;
margin: 0;
padding: 1em;
height: auto;
background-color: #$bgcolor1;
font-family:Arial,sans-serif;
text-decoration: none;
font-weight: normal;
2022-03-24 07:25:20 +01:00
color: #fffffe;
2022-03-23 07:20:56 +01:00
}
ul#AccNavi a:hover {
2022-03-24 07:25:20 +01:00
color: #fffffe;
background-color: #$hgcolor1;
2022-03-23 07:20:56 +01:00
}
ul#AccNavi a:active {
2022-03-24 07:25:20 +01:00
color: #fffffe;
background-color: #$hgcolor1;
2022-03-23 07:20:56 +01:00
}
</style>\n";
#print "<div style='margin-top:40px;'>\n";
print "<ul id='AccNavi'>\n";
foreach my $id1 (sort {$node1->{$a}->{n_sort} <=> $node1->{$b}->{n_sort}} keys (%$node1)){
#Creditcard test switch for payone (tinkwwp)
if($users_sharee->{c_id} && ($path =~ /$varenv->{mandant}\/$varenv->{profile}/ || $path =~ /$varenv->{mandant}\/Account/)){
my $mstyle_1="";
my $mstyle_1_5="";
my $mstyle_2="";
my $mstyle_3="";
if($node_meta->{main_id} == $node1->{$id1}->{main_id}){
2022-03-24 07:25:20 +01:00
$mstyle_1 .= "background-color: #$hgcolor1;" if("$node1->{$id1}->{node_name}" eq "$varenv->{accounting_1}");
$mstyle_1_5 .= "background-color: #$hgcolor1;" if("$node1->{$id1}->{node_name}" eq "$varenv->{accounting_1_5}");
$mstyle_2 .= "background-color: #$hgcolor1;" if("$node1->{$id1}->{node_name}" eq "$varenv->{accounting_2}");
$mstyle_3 .= "background-color: #$hgcolor1;" if("$node1->{$id1}->{node_name}" eq "$varenv->{accounting_3}");
2022-03-23 07:20:56 +01:00
#Konrad & TINK & sharee AGB
if(!$users_sharee->{int14} && !$users_sharee->{int15} && !$users_sharee->{txt30}){
print $q->li($q->a({-style=>"$mstyle_1",-title=>"$node1->{$id1}->{node_name}", -href=>"/$viewsel[0]/Account/$node1->{$id1}->{node_name}$session"}, "$node1->{$id1}->{node_name}")),"\n";
}
elsif(!$users_sharee->{int03}){
print $q->li($q->a({-style=>"$mstyle_1",-title=>"$varenv->{accounting_1}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1}$session"}, $q->span({-class=>"bi bi-file-earmark-person"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_1_5",-title=>"$varenv->{accounting_1_5}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1_5}$session"}, $q->span({-class=>"bi bi-credit-card"}))),"\n";
}
elsif($payable_check){
print $q->li($q->a({-style=>"$mstyle_1",-title=>"$varenv->{accounting_1}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1}$session"}, $q->span({-class=>"bi bi-file-earmark-person"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_1_5",-title=>"$varenv->{accounting_1_5}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1_5}$session"}, $q->span({-class=>"bi bi-credit-card"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_2",-title=>"$varenv->{accounting_2}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_2}$session"},$q->span({-class=>"bi bi-cash"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_3",-title=>"$varenv->{accounting_3}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_3}$session"},$q->span({-class=>"bi bi-list-ul"}))),"\n";
}
else{
print $q->li($q->a({-style=>"$mstyle_1",-title=>"$varenv->{accounting_1}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1}$session"}, $q->span({-class=>"bi bi-file-earmark-person"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_1_5",-title=>"$varenv->{accounting_1_5}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_1_5}$session"}, $q->span({-class=>"bi bi-credit-card"}))),"\n";
print $q->li($q->a({-style=>"$mstyle_2",-title=>"$varenv->{accounting_2}", -href=>"/$viewsel[0]/Account/$varenv->{accounting_2}$session"},$q->span({-class=>"bi bi-cash"}))),"\n";
}
}
}
}
print "</ul>\n";
#print "</div>\n";
#-----------------
2022-03-30 13:06:39 +02:00
}
2022-03-23 07:20:56 +01:00
#print $q->div({-style=>'position:fixed;bottom:4%;right:2%;z-index:10;font-size:13px;'},"--> $varenv->{syshost} | $varenv->{merchant_id} | $bgcolor1 | template -> $node_meta->{tpl_name} | $users_sharee->{c_id}"),"\n" if($users_sharee->{c_id} eq $dbt->{copri_conf}->{superu_id} || $dbt->{copri_conf}->{stage} eq "test");
2021-12-30 12:05:56 +01:00
}
1;