~ ;
}
}
}
if ($event_or_analytics eq 'event') {
&db_min_ro($table,"*","quote_nr='$id'",'','') ;
if ($db{$table}{$id}{city_id} =~ /,/) {
$sort_field{12} = 'cities' ;
} else {
$sort_field{13} = '' ;
}
&db_min_ro('event_quotes_min',"*","id='$id'",'','') ;
&db_min_ro('users','id,name,user_type,phone',"user_type LIKE 'casual%'",'','') ;
foreach (keys %{$db{users}}) {
$casual_name{$_} = $db{users}{$_}{name} ;
# my $casual_type = $db{users}{$_}{user_type} ; $casual_type =~ s/_casual//g ;
$casual_type{$_} = uc substr($db{users}{$_}{user_type},-1,1) ;
}
# %col_name = () ;
# &db_min_ro('countries','id,name',"id=$db{$table}{$id}{country_id}",'','') if $db{$table}{$id}{country_id} ;
# foreach (keys %{$db{countries}}) { $country{$_} = $db{countries}{$_}{name} ; }
%col_name = () ;
&db_min_ro('event_types','id,name',"id=$db{$table}{$id}{type}",'','') if $db{$table}{$id}{type} ;
foreach (keys %{$db{event_types}}) { $event_type{$_} = $db{event_types}{$_}{name} ; }
%col_name = () ;
&db_min_ro('customers','id,name',"id=$db{$table}{$id}{quote_to}",'','') if $db{$table}{$id}{quote_to} ;
foreach (keys %{$db{customers}}) { $customers{$_} = $db{customers}{$_}{name} ; }
%col_name = () ;
# &db_min_ro('events','id,event_quote_nr,category,user_id',"event_quote_nr='$id'",'','') ;
# my $user_id = $db{$table}{$id}{user_id} ;
my $quote_nr = $db{$table}{$id}{quote_nr} ;
my $start = $db{$table}{$id}{date_from} ;
my $end = $db{$table}{$id}{date_to} ;
my $date_start = substr($start,0,10);
my $date_end = substr($end,0,10);
# for (1 .. $max_operators) {
# local $field = "operator_$_\_workings_event" ;
# $op_id = $db{$table}{$id}{$field} ;
my %selected_names = () ;
# &common_debug("operator_workings_event : $db{event_quotes_min}{$id}{operator_workings_event} , id : $id") ;
foreach my $op_id (split(";",$db{event_quotes_min}{$id}{operator_workings_event})) {
next unless $op_id ;
next if $done_op{$op_id}{$quote_nr} ;
$this_user_subscribed{$op_id} = 1 ;
$cat{$date_start}{$date_end}{$quote_nr}{$op_id} = 'assigned' ;
$ccnt{$date_start}{$date_end}{$casual_type{$op_id}}{$quote_nr}++ ;
$subscribed_names{$date_start}{$date_end}{$casual_type{$op_id}}{$quote_nr} .= "$casual_name{$op_id}, " ;
$done_op{$op_id}{$quote_nr} = 1 ;
# $selected_names{operator_names_type_a}{$op_id}{$id} = 'SELECTED' if $casual_type{$op_id} eq 'A' ;
# $selected_names{operator_names_type_b}{$op_id}{$id} = 'SELECTED' if $casual_type{$op_id} eq 'B' ;
# &common_debug("op_id : $op_id , casual_type : $casual_type{$op_id} , id : $id") ;
}
&db_min_ro('events','id,event_quote_nr,category,user_id,startdate,enddate',"user_id='$userid' OR event_quote_nr='$id'",'','') ;
# &db_min_ro('events','id,event_quote_nr,category,user_id,startdate,enddate',"(user_id='$userid' OR event_quote_nr='$id') AND startdate LIKE '$date_start%' AND enddate LIKE '$date_end%'",'','') ;
foreach (keys %{$db{events}}) {
my $start = $db{events}{$_}{startdate} ; my $edate_start = substr($start,0,10);
my $end = $db{events}{$_}{enddate} ; my $edate_end = substr($end,0,10);
$qnr = $db{events}{$_}{event_quote_nr} ;
$uid = $db{events}{$_}{user_id} ;
if ($date_start ne $edate_start) { next ; }
if ($date_end ne $edate_end) { next ; }
# $booked_this_one{$uid}{$qnr}{$db{events}{$_}{category}} = 1 ;
$cat{$edate_start}{$edate_end}{$qnr}{$uid} = $db{events}{$_}{category} ;
# $ccnt{$edate_start}{$edate_end}{$casual_type{$uid}}{$qnr}++ if $cat{$edate_start}{$edate_end}{$qnr}{$uid} eq 'available' ;
# $subscribed_names{$edate_start}{$edate_end}{$casual_type{$uid}}{$qnr} .= "$casual_name{$uid}, " if $cat{$edate_start}{$edate_end}{$qnr}{$uid} eq 'available' ;
&check_dates_booked($qnr,$uid,$db{events}{$_}{startdate},$db{events}{$_}{enddate}) if $cat{$edate_start}{$edate_end}{$qnr}{$uid} eq 'available' ;
}
my $casual_1_type = $db{$table}{$id}{casual_worker} ;
my $casual_2_type = $db{$table}{$id}{casual_worker_2} ;
$preferred_title{date_from} = 'Date From' ;
$preferred_title{date_to} = 'Date To' ;
$preferred_title{quote_to} = 'Client' ;
$preferred_title{nr_of_casuals} = 'Nr of Operators' ; # . $casual_1_type ;
$preferred_title{nr_of_casuals_2} = 'Nr of Operators' ; # . $casual_2_type ;
$preferred_title{ref} = 'Event Name' ;
$lcol = 2 ; $fcol = 8 ;
# foreach (sort { $col_name{$a} cmp $col_name{$b} } keys %col_name) {
# $col = $col_name{$_} ;
my $casuals_1_subscribed = sprintf("%0.0f",$ccnt{$date_start}{$date_end}{$casual_1_type}{$id}) ;
my $casuals_2_subscribed = sprintf("%0.0f",$ccnt{$date_start}{$date_end}{$casual_2_type}{$id}) ;
chop $subscribed_names{$date_start}{$date_end}{$casual_1_type}{$id} ; chop $subscribed_names{$date_start}{$date_end}{$casual_1_type}{$id} ;
chop $subscribed_names{$date_start}{$date_end}{$casual_2_type}{$id} ; chop $subscribed_names{$date_start}{$date_end}{$casual_2_type}{$id} ;
my $casual_1_names_subscribed = '[' . $subscribed_names{$date_start}{$date_end}{$casual_1_type}{$id} . ']' if $subscribed_names{$date_start}{$date_end}{$casual_1_type}{$id} ;
my $casual_2_names_subscribed = '[' . $subscribed_names{$date_start}{$date_end}{$casual_2_type}{$id} . ']' if $subscribed_names{$date_start}{$date_end}{$casual_2_type}{$id} ;
# my $operator_id = 0 ;
# my %selected_names = () ;
# for (1 .. $max_operators) {
# $operator_id = $db{$table}{$id}{"operator_$_\_workings_event"} ;
# $selected_names{operator_names_type_a}{$operator_id}{$id} = 'SELECTED' if $operator_id and $casual_type{$operator_id} eq 'A' ;
# $selected_names{operator_names_type_b}{$operator_id}{$id} = 'SELECTED' if $operator_id and $casual_type{$operator_id} eq 'B' ;
# }
# $selected_names{operator_names_type_a}{48}{$id} = 'SELECTED' ;
foreach my $casual_id (keys %casual_name){
$opts{operator_names_type_a} .= qq() if $casual_type{$casual_id} eq 'A' ;
$opts{operator_names_type_b} .= qq() if $casual_type{$casual_id} eq 'B' ;
}
my @club_ids_arr = () ;
foreach (split(";",$db{$table}{$id}{club_ids})) {
push @club_ids_arr , "`id` = '$_'" if $_ ;
}
my $club_ids_sql = join(" OR ",@club_ids_arr) ;
$club_ids_sql = "($club_ids_sql)" if $club_ids_sql ;
&db_min_ro('clubs','id,name',"$club_ids_sql",'','');
if ($date_start eq $date_end) {
$sort_field{3} = 'date' ;
$sort_field{4} = '' ;
$preferred_title{date_from} = 'Date' ;
}
my @times_from = split(/\;/,$db{$table}{$id}{times_from}) ;
my @times_to = split(/\;/,$db{$table}{$id}{times_to}) ;
my @times_from_com = () ; my @times_to_com = () ;
push @times_from_com,substr($db{$table}{$id}{date_from},11) ;
my @days_active = split(/\;/,$db{$table}{$id}{days_active}) ;
my %dates_hash = () ;
for (1 .. 10) {
my ($year,$month,$day) = split(/\-/,substr($db{$table}{$id}{date_from},0,10)) ;
my ($new_year,$new_month,$new_day) = Add_Delta_Days($year,$month,$day,$_-1) ;
$new_day = sprintf("%02s",$new_day) ; $new_month = sprintf("%02s",$new_month) ;
$dates_hash{$_} = "$new_year-$new_month-$new_day" ;
push @times_from_com,$times_from[$_-2] if $times_from[$_-2] && $_ > 1 ;
push @times_from_com,substr($db{$table}{$id}{date_from},11) if !$times_from[$_-2] && $_ > 1 ;
last if substr($db{$table}{$id}{date_to},0,10) eq "$new_year-$new_month-$new_day" ;
push @times_to_com,$times_to[$_-1] if $times_to[$_-1] ;
push @times_to_com,substr($db{$table}{$id}{date_to},11) if !$times_to[$_-1] ;
}
my $system_count = 0 ; my $system_day_cnt = 0 ; my %system_has_daily_op = () ;
foreach my $system_row (split(/\|/,$db{$table}{$id}{daily_operator_ids})) {
$system_count++ ;
next unless $system_row ;
$system_day_cnt = 0 ;
foreach my $col (split(/\;/,$system_row)) {
$system_day_cnt++ ;
next unless $col ;
$default_op_ids{$system_count}{$system_day_cnt} = $col if $col ;
$system_daily_ops{$system_count} .= qq~Day $system_day_cnt : $db{users}{$col}{name}, ~ if $col ;
}
chop $system_daily_ops{$system_count} if $system_daily_ops{$system_count} ;
chop $system_daily_ops{$system_count} if $system_daily_ops{$system_count} ;
}
$system_count = 0 ;
# push @times_to_com, substr($db{$table}{$id}{date_to},11) ;
# my $system_count = 0 ; my $system_day_cnt = 0 ; my %system_has_daily_op = () ;
# foreach my $system_row (split(/\|/,$db{$table}{$id}{daily_operator_ids})) {
# $system_count++ ;
# next unless $system_row ;
# $system_day_cnt = 0 ;
# foreach my $col (split(/\;/,$system_row)) {
# $system_day_cnt++ ;
# next unless $col ;
# $default_op_ids{$system_count}{$system_day_cnt} = $col if $col ;
# $system_daily_ops{$system_count} .= qq~Day $system_day_cnt : $db{users}{$col}{name}, ~ if $col ;
# }
# chop $system_daily_ops{$system_count} if $system_daily_ops{$system_count} ;
# chop $system_daily_ops{$system_count} if $system_daily_ops{$system_count} ;
# }
# $system_count = 0 ;
}
foreach my $cnt (sort {$a <=> $b} keys %sort_field) {
$col = $sort_field{$cnt} ;
next if !$col || $col eq 'quote_nr' ;
$val = $db{$table}{$id}{$col} ;
# next if not $val and $col ne 'operator_names_type_a' and $col ne 'operator_names_type_b' and $col ne 'category_1_sub-Categories' and $col ne 'category_2_sub-Categories' ;
# $val = $country{$val} if $col eq 'country_id' ;
$val = $customers{$val} if $col eq 'quote_to' ;
# $val = $event_type{$val} if $col eq 'type' ;
if ($col eq 'nr_of_casuals') {
$casuals_1_subscribed = 0 unless $casuals_1_subscribed ;
$db{$table}{$id}{nr_of_casuals} = 0 unless $db{$table}{$id}{nr_of_casuals} ;
$val = "$casuals_1_subscribed/$val $casual_1_names_subscribed" ;
$fully_substribed{$casual_1_type} = 1 if $casuals_1_subscribed >= $db{$table}{$id}{nr_of_casuals} ;
} elsif ($col eq 'nr_of_casuals_2') {
$casuals_2_subscribed = 0 unless $casuals_2_subscribed ;
$db{$table}{$id}{nr_of_casuals_2} = 0 unless $db{$table}{$id}{nr_of_casuals_2} ;
$val = "$casuals_2_subscribed/$val $casual_2_names_subscribed" ;
$fully_substribed{$casual_2_type} = 1 if $casuals_2_subscribed >= $db{$table}{$id}{nr_of_casuals_2} ;
} elsif ($col eq 'date_from' || $col eq 'date') {
$val = &process_date($db{$table}{$id}{date_from}) ;
$val .= qq~ to ~ . substr($times_to_com[0],0,5) ;
$val .= substr($db{$table}{$id}{date_to},11,5) if $col eq 'date' ;
} elsif ($col eq 'date_to') {
$val = &process_date($db{$table}{$id}{date_to}) ;
$val = substr($val,0,-5) . substr($times_from_com[-1],0,5) . qq~ to ~ . substr($val,-5,5) ;
} elsif ($col eq 'operator_names_type_a'){
next unless $db{$table}{$id}{nr_of_casuals} ;
# $preferred_title{$col} = "Operator Names A" ;
# $fcol = 3 ;
# $multiple{$col} = 1 ;
# $setmultiple = 'multiple' ;
# $print_box_content_rows .= &common_min_form_select($col,'') ;
# $print_box_content_rows . "" ;
} elsif ($col eq 'operator_names_type_b') {
# next unless $db{$table}{$id}{nr_of_casuals_2} ;
# $preferred_title{$col} = "Operator Names B" ;
# $fcol = 3 ;
# $multiple{$col} = 1 ;
# $setmultiple = 'multiple' ;
# $print_box_content_rows .= &common_min_form_select($col,'') ;
} elsif ($col eq 'sport_type_ids') {
$val = qq~~ ;
foreach (split(",",$db{$table}{$id}{sport_type_ids})) {
$val .= qq~$db{sport_types}{$_}{name}, ~ ;
}
chop $val if $val ; chop $val if $val ;
}
# elsif ($col eq 'city_id') {
# $val = $db{cities}{$val}{city} ;
# $val .= qq~, $db{regions}{$db{$table}{$id}{region_id}}{name}~ if $db{$table}{$id}{region_id} ;
# }
# elsif ($col eq 'organisation_ids') {
# $val = qq~~ ;
# foreach (split(",",$db{$table}{$id}{organisation_ids})) {
# $val .= qq~$db{organisations}{$_}{name}, ~ ;
# }
# chop $val if $val ; chop $val if $val ;
# }
# event_quotes_poc','id,name,contact_nr
elsif ($col eq 'poc_name') {
$val = $db{event_quotes_poc}{$db{$table}{$id}{poc_id}}{name} ;
} elsif ($col eq 'poc_contact_nr') {
$val = $db{event_quotes_poc}{$db{$table}{$id}{poc_id}}{contact_nr} ;
$val =~ s/ //g ;
if (substr($val,0,2) eq '27' && length($val) == 11) {
$val = "+27 " . substr($val,2,2) . " " . substr($val,4,3) . " " . substr($val,7,4) ;
} elsif ((substr($val,0,2) eq '07' || substr($val,0,2) eq '08' || substr($val,0,2) eq '02') && length($val) == 10) {
$val = "+27 " . substr($val,1,2) . " " . substr($val,3,3) . " " . substr($val,6,4) ;
} else {
$val = $db{event_quotes_poc}{$db{$table}{$id}{poc_id}}{contact_nr} ;
}
} elsif ($col eq 'category_1_sub_categories') {
my @a = split('\|;\|',$db{event_quotes_min}{$id}{category_details}) ;
$a[0] =~ s/\n/ /g;
$a[0] = substr($a[0],0,-4) if substr($a[0],-4,4) eq ' ' ;
$val = $a[0] ;
next unless $val ;
} elsif ($col eq 'category_2_sub_categories') {
my @a = split('\|;\|',$db{event_quotes_min}{$id}{category_details}) ;
$a[1] =~ s/\n/ /g;
$a[1] = substr($a[1],0,-4) if substr($a[1],-4,4) eq ' ' ;
$val = $a[1] ;
next unless $val ;
} elsif ($col eq 'category_1') {
$val = $db{event_quotes_categories}{$db{$table}{$id}{category_id_1}}{category} ;
} elsif ($col eq 'category_2') {
$val = $db{event_quotes_categories}{$db{$table}{$id}{category_id_2}}{category} ;
} elsif ($col eq 'type_details') {
# event_system_id_multiple
$val = qq~~ ;
foreach my $type_id (split(",",$db{$table}{$id}{type_details_id})) {
$val .= qq~$db{event_type_details}{$type_id}{name}, ~ ;
}
chop $val if $val ; chop $val if $val ;
} elsif ($col eq 'system_details') {
# elsif ($col eq 'system_name') {
$val = qq~~ ;
# my $cnt_sys = 0 ;
my @club_ids = split(";",$db{$table}{$id}{club_ids}) ;
my @operator_ids = ($db{$table}{$id}{operator_ids} =~ /;/) ? split(";",$db{$table}{$id}{operator_ids}) : split(",",$db{$table}{$id}{operator_ids}) ;
my $cnt_sys = -1 ;
foreach my $event_id (split(/\;/,$db{$table}{$id}{event_system_id_multiple})) {
$cnt_sys++ ;
next if not $event_id and not $club_ids[$cnt_sys] ;
$event_id =~ s/f-//g ;
$val .= qq~$db{event_systems}{$event_id}{name} ~ if $event_id ;
$val .= qq~>>> ~ if $event_id and not $db{event_systems}{$event_id}{description} ;
$val .= qq~($db{event_systems}{$event_id}{description}) >>> ~ if $db{event_systems}{$event_id}{description} and $event_id ;
$val .= qq~NO SYSTEM >>> ~ unless $event_id ;
$val .= qq~$db{clubs}{$club_ids[$cnt_sys]}{name} >>> ~ if $club_ids[$cnt_sys] ;
$val .= qq~NO CLUB >>> ~ unless $club_ids[$cnt_sys] ;
$val .= qq~$db{users}{$operator_ids[$cnt_sys]}{name}~ if $operator_ids[$cnt_sys] ;
$cnt_sys++ ;
$val .= qq~[$system_daily_ops{$cnt_sys}]~ if $system_daily_ops{$cnt_sys} && !$operator_ids[$cnt_sys-1] ;
$cnt_sys-- ;
# $val .= qq~>>> $db{clubs}{$club_ids[$cnt_sys]}{name} ~ if $db{clubs}{$club_ids[$cnt_sys]}{name} ;
# $val .= qq~>>> $db{users}{$operator_ids[$cnt_sys]}{name} ~ if $db{users}{$operator_ids[$cnt_sys]}{name} ;
# $val .= qq~[$db{users}{$operator_ids[$cnt_sys]}{phone}] ~ if $db{users}{$operator_ids[$cnt_sys]}{name} && $db{users}{$operator_ids[$cnt_sys]}{phone} ;
$val .= qq~ ~ ;
# $cnt_sys++ ;
}
# chop $val if $val ; chop $val if $val ;
$val = substr($val,0,-4) if $val ;
}
# elsif ($col eq 'club_name') {
# $val = '' ;
# foreach my $club_id (split(";",$db{$table}{$id}{club_ids})) {
# $val .= qq~$db{clubs}{$club_id}{name} ~ if $club_id ;
# }
# $val =~ s/\n/ /g;
# $val = substr($val,0,-4) if substr($val,-4,-1) eq ' /g;
} elsif ($col eq 'additional_notes') {
$val = $db{$table}{$id}{additional_notes} ;
$val =~ s/\n/ /g;
} elsif ($col eq 'fixture_date/Time_from') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'sport') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'age_group') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'team') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'stream_forwarding') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'stream_key') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
} elsif ($col eq 'stream_URL') {
$val = join(",",map{"$analytics_saved_values{$col}{$_}"} sort {$a <=> $b} keys %{$analytics_saved_values{$col}}) ;
}
next unless $val ;
$print_box_content_rows .= &common_min_form_view($col,$val,'') unless $col eq 'operator_names_type_a' or $col eq 'operator_names_type_b' ;
if ($col eq 'date_from' && substr($db{$table}{$id}{date_from},0,10) ne substr($db{$table}{$id}{date_to},0,10)) {
for (2 .. 9) {
last if substr($db{$table}{$id}{date_to},0,10) eq $dates_hash{$_} ;
next if $db{$table}{$id}{days_active} && !$days_active[$_ - 1] ;
my ($new_year,$new_month,$new_day) = split(/\-/,$dates_hash{$_}) ;
$val = $new_day . "-" . $month_array[$new_month - 1] . "-" . $new_year . " @ " . substr($times_from_com[$_ - 1],0,5) . " to " . substr($times_to_com[$_ - 1],0,5) ;
$print_box_content_rows .= &common_min_form_view(" ",$val,'') ;
}
}
}
$dialog = 0 ;
$addbkb = 0 ;
# $print_box_content_rows .= &common_min_forms_end('','','report') ;
# my @assigned_users_a = split(/\,/,$db{$table}{$id}{operator_names_type_a}s) ;
# my @assigned_users_b = split(/\,/,$db{$table}{$id}{operator_names_type_b}) ;
# my %selected_names = () ;
# for (@assigned_users_a){ $selected_names{operator_names_type_a}{$_}{$id} = 'SELECTED'; }
# for (@assigned_users_b){ $selected_names{operator_names_type_b}{$_}{$id} = 'SELECTED'; }
#
#
# $print_box_content_rows .= qq~
$form_for_save .= qq~
~ ;
$trigger_jquery_raw .= qq~\$("#savebuttcalender").click(function() {
var op_a_val = \$("#selectOperator_names_type_a").chosen().val() ;
var op_b_val = \$("#selectOperator_names_type_b").chosen().val() ;
// const selected_a = op_a_val.split(",") ;
// const selected_b = op_b_val.split(",") ;
// let counter_a = 0 ;
// let counter_b = 0 ;
// for (let i = 0; i < selected_a.length; i++) {
// counter_a++ ;
// }
// for (let i = 0; i < selected_b.length; i++) {
// counter_b++ ;
// }
// var max_ops_a = '$db{$table}{$id}{nr_of_casuals}' ;
// var max_ops_b = '$db{$table}{$id}{nr_of_casuals_2}' ;
// if (max_ops_a < counter_a && max_ops_b < counter_b) {
// noty({text:'Operator A names exceed max nr allowed of '+max_ops_a+'! and Operator B names exceed max nr allowed of '+max_ops_b+'!',layout:"center",type:"error",timeout:3000});
// return;
// } else if (max_ops_b < counter_b && max_ops_a >= counter_a) {
// noty({text:'Operator B names exceed max nr allowed of '+max_ops_b+'!',layout:"center",type:"error",timeout:3000});
// return;
// } else if (max_ops_a < counter_a && max_ops_b >= counter_b) {
// noty({text:'Operator A names exceed max nr allowed of '+max_ops_a+'!',layout:"center",type:"error",timeout:3000});
// return;
// } else {
\$('#operators-type-a').val(op_a_val);
\$('#operators-type-b').val(op_b_val);
\$('#$table-form').submit();
// }
});~ ;
# $trigger_jquery_raw .= qq~\$("#savebuttcalender").click(function() {
# var max_allowed_a = $db{$table}{$id}{nr_of_casuals} ;
# var max_allowed_b = $db{$table}{$id}{nr_of_casuals_2} ;
# if (max_allowed_a < counter_a && max_allowed_b < counter_b) {
# noty({text:'Operator A names exceed max nr allowed of '+max_allowed_a+'! and Operator B names exceed max nr allowed of '+max_allowed_b+'!',layout:"center",type:"error",timeout:3000});
# return;
# } else if (max_allowed_b < counter_b && max_allowed_a >= counter_a) {
# noty({text:'Operator B names exceed max nr allowed of '+max_allowed_b+'!',layout:"center",type:"error",timeout:3000});
# return;
# } else if (max_allowed_a < counter_a && max_allowed_b >= counter_b) {
# noty({text:'Operator A names exceed max nr allowed of '+max_allowed_a+'!',layout:"center",type:"error",timeout:3000});
# return;
# } else {
# \$('#$table-form').submit();
# }
# });~ ;
# $print_box_content_rows . "" ;
$db_ignore_open_close = 0 ; # do one open and one close instead of repeating it
&db_close_conn ;
# my $saction = ($cat{$date_start}{$date_end}{$id}{$userid} eq 'available') ? 'unavailable' : 'available' ; my $butttxt = uc $saction ; my $buttcolor = ($saction eq 'available') ? 'success' : 'danger' ;
my $buttcolor = ($saction eq 'available') ? 'success' : 'danger' ;
if ($cat{$date_start}{$date_end}{$id}{$userid} eq 'available') {
$saction = 'unavailable' ;
} elsif ($cat{$date_start}{$date_end}{$id}{$userid} eq 'assigned') {
$saction = 'available' ;
# $buttcolor = 'info' ;
$buttcolor = 'success' ;
} elsif ($cat{$date_start}{$date_end}{$id}{$userid} eq 'unavailable') {
$saction = 'available' ;
$buttcolor = 'success' ;
}
my $butttxt = uc $saction ;
my ($dy1,$dm1,$dd1,$th1,$tm1,$ts1) = &common_split_sql_time($db{$table}{$id}{date_from}) ;
my ($dy2,$dm2,$dd2,$th2,$tm2,$ts2) = &common_split_sql_time($db{$table}{$id}{date_to}) ;
my $Dd = Delta_Days($dy1,$dm1,$dd1,$dy2,$dm2,$dd2);
# my $nr_of_casuals_1_allowed = sprintf("%0.0f",$db{$table}{$id}{nr_of_casuals}) ;
# if ($casuals_1_subscribed >= $nr_of_casuals_1_allowed and $saction eq 'available') { return ; } # fully subscribed
# my $nr_of_casuals_2_allowed = sprintf("%0.0f",$db{$table}{$id}{nr_of_casuals_2}) ;
# if ($casuals_2_subscribed >= $nr_of_casuals_2_allowed and $saction eq 'available') { return ; } # fully subscribed
my $cnow = $now_ccyymmdd . $now_hour . $now_min . $now_sec ;
my $cstart = $db{$table}{$id}{date_from} ; $cstart =~ s/ //g ; $cstart =~ s/-//g ; $cstart =~ s/://g ;
my $cend = $db{$table}{$id}{date_to} ; $cend =~ s/ //g ; $cend =~ s/-//g ; $cend =~ s/://g ;
my $in_the_past = 0 ;
our $files_attach = qq~~ ;
my $pdf_tooltip_extra = ($event_or_analytics eq 'analytics') ? "ANALYTICS EVENT" : "EVENT" ;
my $pdf_tooltip_extra2 = ($event_or_analytics eq 'analytics') ? "Analytics Event" : "Event" ;
$files_attach .= qq~
~ if $glod_user_level > 1 ;
for (1 .. 3) {
$working_uploads = &get_event_uploads($qid,"upload_$_",'id') ;
if ($working_uploads) {
$files_attach .= qq~
$working_uploads
~ ;
}
}
# ;;;;6797|;;;;6797|;;;;6797|;8;;;6797
if ($cstart < $cnow && $cend < $cnow) { # event in the past
# if (1) { # event in the past
if ($analytics_event_exists) {
if ($analytics_table) {
$analytics_table_body .= qq~
Event has past
$files_attach
~ ;
} else {
$print_box_content_rows .= qq~
Event has past
$files_attach
~ ;
}
} else {
$print_box_content_rows .= qq~
Event has past
$files_attach
~ ;
}
return ;
} else {
if ($analytics_event_exists) {
if ($analytics_table) {
$analytics_table_body .= qq~