fuck embedded iframes and their stupid display problems with scrolling. also make...
[freeside.git] / httemplate / view / cust_main / notes.html
1 % if ( scalar(@notes) ) {
2
3   <% include('/elements/init_overlib.html') %>
4
5   <% include("/elements/table-grid.html") %>
6
7   <TR>
8     <TH CLASS="grid" BGCOLOR="#cccccc">Date</TH>
9     <TH CLASS="grid" BGCOLOR="#cccccc">Time</TH>
10     <TH CLASS="grid" BGCOLOR="#cccccc">Person</TH>
11     <TH CLASS="grid" BGCOLOR="#cccccc">Note</TH>
12   </TR>
13
14 % my $bgcolor1 = '#eeeeee';
15 % my $bgcolor2 = '#ffffff';
16 % my $bgcolor = '';
17 %
18 % foreach my $note (@notes) {
19 %
20 %   if ( $bgcolor eq $bgcolor1 ) {
21 %     $bgcolor = $bgcolor2;
22 %   } else {
23 %     $bgcolor = $bgcolor1;
24 %   }
25 %
26 %   my $pop = popurl(3);
27 %   my $notenum = $note->notenum;
28 %   my $onclick = include( '/elements/popup_link_onclick.html',
29 %                            'action'      => popurl(2).
30 %                                             'edit/cust_main_note.cgi'.
31 %                                             "?custnum=$custnum".
32 %                                             ";notenum=$notenum",
33 %                            'actionlabel' => 'Edit customer note',
34 %                            'width'       => 616,
35 %                            'height'      => 408,
36 %                            'frame'       => 'top',
37 %                        );
38 %   my $clickjs = qq!onclick="$onclick"!;
39 %
40 %   my $edit = '';
41 %   if ($curuser->access_right('Edit customer note') ) {
42 %     $edit = qq! <A HREF="javascript:void(0);" $clickjs>(edit)</A>!;
43 %   }
44
45     <TR>
46       <% note_datestr($note,$conf,$bgcolor) %>
47       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
48         &nbsp;<% $note->otaker%>
49       </TD>
50       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
51         &nbsp;<%$note->comments%><% $edit %>
52       </TD>
53     </TR>
54
55 % } #end display notes
56
57 </TABLE>
58
59 % }
60 <%init>
61
62 my $conf = new FS::Conf;
63 my $curuser = $FS::CurrentUser::CurrentUser;
64
65 my(%opt) = @_;
66
67 my $custnum = $opt{'custnum'};
68
69 my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} );
70 die "Custimer not found!" unless $cust_main;
71
72 my (@notes) = $cust_main->notes();
73
74 #subroutines
75
76 sub note_datestr {
77   my($note, $conf, $bgcolor) = @_ or return '';
78   my $td = '<TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">';
79   my $format = "$td%b&nbsp;%o,&nbsp;%Y</TD>";
80   $format .= "$td%l:%M%P</TD>"
81     if $conf->exists('cust_main_note-display_times');
82   ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;
83   $strip;
84 }
85
86 </%init>