style
[freeside.git] / httemplate / view / cust_main / menu.html
1 <style type="text/css">
2
3 #customer_menu {
4   margin-top: .6em;
5   margin-bottom: 16px;
6 }
7
8 /* #customer_menu .ui-menu-item  */
9 #customer_menu > li {
10   background-color: #f8f8f8;
11 }
12
13 /* #customer_menu .ui-menu-item  */
14 #customer_menu > li.ui-state-focus {
15   background-color: #f8f8f8;
16 }
17
18 #customer_menu > li.ui-state-active {
19   background-color: #f8f8f8;
20 }
21
22 #customer_menu > li > a {
23   border-top: 1px solid transparent;
24   border-left: 1px solid transparent;
25   border-right: 1px solid transparent;
26   border-bottom: none;
27   padding: .5em .75em;
28 }
29
30 #customer_menu > li.ui-state-active > a {
31
32 /* if i could find something light enough that didn't look pink?
33      or is this too visually distracting and not the useful hint i think it is?
34   background: #ED55E7;
35 */
36 }
37
38 #customer_menu a.current_show {
39   font-weight: bold;
40   background: #FFFFFF;
41   border-top: 1px solid #7e0079;
42   border-left: 1px solid #7e0079;
43   border-right: 1px solid #7e0079;
44   border-bottom: 2px solid #ffffff;
45   margin-bottom: -2px;
46   border-bottom-left-radius: 2px;
47   border-bottom-right-radius: 2px;
48 }
49
50 #customer_menu a {
51   margin-left: 0;
52   margin-right: 1em;
53   margin-top: 0;
54   border-top-left-radius: .5em;
55   border-top-right-radius: .5em;
56
57   font-weight: normal;
58   background: #e0e0e0;
59   color: #525151;
60   text-decoration: none;
61 }
62
63 #customer_menu ul a {
64   background: transparent;
65 }
66
67 </style>
68
69 <& /elements/dropdown-menu.html,
70      'id'        => 'customer_menu',
71      #'class'     => 'customer_submenu',
72                     #XXX support installs outside /freeside in 4.x
73      'self_url'  => "/freeside/view/cust_main.cgi?custnum=$custnum;show=",
74      'menu'      => \@menu,
75      'cust_main' => $cust_main,
76      'show'      => $opt{'show'},
77 &>
78
79 <%init>
80 my %opt = @_;
81 my $cust_main = $opt{'cust_main'};
82 my $custnum = $cust_main->custnum;
83 my $curuser = $FS::CurrentUser::CurrentUser;
84 my $conf = FS::Conf->new;
85
86 my %payby = map { $_ => 1 } $conf->config('payby');
87
88 # cached for conditions, to avoid looking it up twice
89 my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
90
91 # nice declarative menu; a parameter to some kind of menu generator
92 my @menu = ( 
93   [
94     { show        => 'basics',
95       label       => 'Basics',
96     },
97     {
98       label       => 'Edit customer',
99       url         => "edit/cust_main.cgi?$custnum",
100       acl         => 'Edit customer'
101     },
102     {
103       label       => 'Edit contacts',
104       url         => "edit/cust_main-contacts.html?$custnum",
105     },
106
107     { label   => '-',
108       content => '-',
109     },
110
111     {
112       label       => 'Bill now',
113       acl         => 'Bill customer now',
114       content     => sub { include( '/elements/bill.html',
115                               label   => emt('Bill now'),
116                               url     => $cgi->self_url,
117                               custnum => shift->custnum,
118                            ),
119                      },
120     },
121     {
122       label       => 'Suspend',
123       popup       => "misc/suspend_cust.html?custnum=$custnum",
124       acl         => 'Suspend customer',
125       condition   => sub { shift->unsuspended_pkgs > 0 },
126       actionlabel => 'Confirm Suspension',
127       color       => '#ff9900',
128     },
129     {
130       label       => 'Unsuspend',
131       popup       => "misc/unsuspend_cust.html?custnum=$custnum",
132       acl         => 'Unsuspend customer',
133       condition   => sub { shift->suspended_pkgs > 0 },
134       actionlabel => 'Confirm Unsuspension',
135     },
136     {
137       label       => 'Cancel',
138       popup       => "misc/cancel_cust.html?custnum=$custnum",
139       acl         => 'Cancel customer',
140       condition   => sub { shift->ncancelled_pkgs > 0 },
141       actionlabel => 'Confirm Cancellation',
142       color       => '#ff0000',
143     },
144     {
145       label       => 'Merge',
146       popup       => "misc/merge_cust.html?custnum=$custnum",
147       acl         => 'Merge customer',
148       actionlabel => 'Merge customer',
149       width       => 569,
150       height      => 210,
151     },
152     {
153       label       => 'Refer a new customer',
154       url         => "edit/cust_main.cgi?referral_custnum=$custnum",
155       confexists  => '!disable_customer_referrals',
156     },
157
158     { label   => '-',
159       content => '-',
160     },
161
162     {
163       label       => 'View this customer\'s referrals',
164       url         => "search/cust_main.cgi?referral_custnum=$custnum",
165       confexists  => '!disable_customer_referrals',
166       condition   => sub {
167         FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
168       },
169     },
170     {
171       label       => 'View billing events',
172       url         => "search/cust_event.html?custnum=$custnum",
173       acl         => [ 'Billing event reports',
174                        'View customer billing events' ],
175     },
176     {
177       label       => 'Email a notice to this customer',
178       url         => sub {
179                       my $cust_main = shift;
180                       my $agentnum = $cust_main->agentnum;
181                       'misc/email-customers.html?table=cust_main;'.
182                       'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
183                       uri_escape($cgi->self_url);
184                      },
185       condition   => sub { $invoicing_list_emailonly },
186       acl         => 'Bulk send customer notices',
187     },
188   ],
189   [
190     {
191       label => 'Notes',
192       show  => 'notes',
193     },
194     {
195       label       => 'Add note',
196       popup       => "edit/cust_main_note.cgi?custnum=$custnum",
197       actionlabel => 'Add note',
198       confexists  => '!cust_main-disable_notes',
199       acl         => 'Add customer note',
200       width       => 875,
201       height      => 538,
202     },
203     {
204       label       => 'Attach file',
205       popup       => "edit/cust_main_attach.cgi?custnum=$custnum",
206       actionlabel => 'Upload file',
207       confexists  => '!disable_cust_attachment',
208       acl         => 'Add attachment',
209       width       => 480,
210       height      => 296,
211     },
212   ],
213   [
214     {
215       label => 'Tickets',
216       show  => 'tickets',
217       confexists => 'ticket_system'
218     },
219   ],
220   [
221     {
222       label => 'Appointments',
223       show  => 'appointments',
224       confexists => 'ticket_system',
225       acl   => 'View appointments',
226     },
227     {
228       label       => 'Schedule new appointment',
229       confexists  => 'ticket_system',
230       acl        => 'Make appointment',
231       popup       => "misc/make_appointment.html?custnum=$custnum",
232       actionlabel => 'Schedule appointment',
233     },
234   ],
235   [
236     {
237       label => 'Quotations',
238       show  => 'quotations',
239     },
240     {
241       label => 'Create new quotation',
242       url   => "edit/quotation.html?custnum=$custnum",
243       acl   => 'Generate quotation',
244     },
245   ],
246   [
247     {
248       label => 'Packages',
249       show  => 'packages',
250     },
251     {
252       label       => 'New qualification',
253       popup       => "misc/qual.html?custnum=$custnum",
254       actionlabel => 'New qualification',
255       color       => '#333399',
256       width       => 763,
257       height      => 436,
258       acl         => 'Qualify service',
259     },
260     {
261       label       => 'Order new package',
262       popup       => "misc/order_pkg.html?custnum=$custnum",
263       actionlabel => 'Order new package',
264       color       => '#333399',
265       width       => 960,
266       height      => 740,
267       acl         => 'Order customer package',
268     },
269     {
270       # it's just a popup, but there's some freaky CCH tax stuff in it
271       label       => 'One-time charge',
272       url         => "edit/quick-charge.html?custnum=$custnum",
273       acl         => 'One-time charge',
274     },
275     {
276       label       => 'Move services between packages',
277       popup       => "edit/bulk-cust_svc-pkgnum.html?custnum=$custnum",
278       actionlabel => 'Move services',
279       width       => 968,
280       height      => 575,
281       acl         => 'Bulk move customer services',
282     },
283     {
284       label       => 'Bulk order and cancel packages',
285       url         => "edit/cust_pkg.cgi?$custnum",
286       acl         => 'Bulk change customer packages',
287     },
288
289     { label   => '-',
290       content => '-',
291     },
292
293     {
294       label => 'Package reports',
295       url   => "search/report_cust_pkg.html?custnum=$custnum",
296     },
297     {
298       label => 'View qualifications',
299       url   => "search/qual.cgi?custnum=$custnum",
300       acl   => 'Qualify service',
301     },
302     {
303       label => 'View accounts',
304       url   => "search/report_svc_acct.html?custnum=$custnum",
305     },
306     {
307       label => 'View data usage',
308       popup => "search/report_sqlradius_usage-custnum.html?$custnum",
309       acl   => 'Usage: RADIUS sessions',
310       actionlabel => 'Data usage report',
311       width   => 480,
312       height  => 345,
313       condition => sub { shift->num_usage_pkgs > 0 },
314     },
315     {
316       label => 'View CDRs',
317       url   => "search/report_cdr.html?custnum=$custnum",
318       # XXX should have a condition that the customer has any CDR packages
319     },
320   ],
321   [
322     {
323       label => 'Payment History',
324       show  => 'payment_history',
325     },
326
327     # manual payment entry via edit/cust_pay
328     { label   => 'Enter payment',
329       submenu => [
330         {
331           label       => 'Enter check payment',
332           popup       => "edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum",
333           actionlabel => 'Enter check payment',
334           width       => 763,
335           height      => 392,
336           acl         => [ 'Post payment', 'Post check payment' ],
337         },
338         {
339           label       => 'Enter cash payment',
340           popup       => "edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum",
341           actionlabel => 'Enter cash payment',
342           width       => 763,
343           height      => 392,
344           acl         => [ 'Post payment', 'Post cash payment' ],
345         },
346         #{
347         #  label       => 'Enter Western Union payment',
348         #  popup       => "edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum",
349         #  actionlabel => 'Enter Western Union payment',
350         #  width       => 763,
351         #  height      => 392,
352         #  acl         => [ 'Post payment', ],
353         ##  condition   => sub { $payby{WEST} },
354         #},
355         #{
356         #  label       => 'Record manual (offline/POS) credit card payment',
357         #  popup       => "edit/cust_pay.cgi?popup=1;payby=MCRD;custnum=$custnum",
358         #  actionlabel => 'Enter credit card payment',
359         #  width       => 763,
360         #  height      => 392,
361         #  acl         => [ 'Post payment', ],
362         ##  condition   => sub { $payby{MCRD} },
363         #},
364         #{
365         #  label       => 'Record manual (offline/POS) electronic check',
366         #  popup       => "edit/cust_pay.cgi?popup=1;payby=MCHK;custnum=$custnum",
367         #  actionlabel => 'Enter credit card payment',
368         #  width       => 763,
369         #  height      => 392,
370         #  acl         => [ 'Post payment', ],
371         ##  condition   => sub { $payby{MCHK} },
372         #},
373       ],
374     },
375
376     # realtime payments via payment.cgi
377     { label   => 'Process payment',
378       submenu => [
379         {
380           label       => 'Process credit card payment',
381           url         => "misc/payment.cgi?payby=CARD;custnum=$custnum",
382           acl         => [ 'Process payment', 'Process credit card payment', ],
383           condition   => sub { $payby{CARD} or $payby{DCRD} },
384         },
385         {
386           label       => 'Process electronic check payment',
387           url         => "misc/payment.cgi?payby=CHEK;custnum=$custnum",
388           acl         => [ 'Process payment', 'Process Echeck payment', ],
389           condition   => sub { $payby{CHEK} or $payby{DCHK} },
390         },
391       ],
392     },
393
394     { label   => '-',
395       content => '-',
396     },
397
398     {
399       label       => 'Enter credit',
400       popup       => "edit/cust_credit.cgi?custnum=$custnum",
401       actionlabel => 'Enter credit',
402       width       => 763,
403       acl         => 'Post credit',
404     },
405     {
406       label       => 'Credit line items',
407       popup       => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
408       actionlabel => 'Credit line items',
409       width       => 968,
410       height      => 575,
411       acl         => 'Credit line items',
412       condition   => sub {
413         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
414       },
415     },
416
417     { label   => '-',
418       content => '-',
419     },
420
421     { label   => 'Enter refund',
422       submenu => [
423
424         {
425           label       => 'Enter check refund',
426           popup       => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
427           actionlabel => 'Enter check refund',
428           width       => 440,
429           acl         => ['Post refund', 'Post check refund'],
430         },
431         {
432           label       => 'Enter cash refund',
433           popup       => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
434           actionlabel => 'Enter cash refund',
435           width       => 392,
436           acl         => ['Post refund', 'Post cash refund'],
437         },
438         #{
439         #  label       => 'Record manual (offline/POS) credit card refund',
440         #  popup       => "edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum",
441         #  actionlabel => 'Enter credit card refund',
442         #  width       => 440,
443         #  acl         => ['Post refund' ],
444         ##  condition   => sub { $payby{MCRD} },
445         #},
446         #{
447         #  label       => 'Record manual (offline/POS) electronic check refund',
448         #  popup       => "edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum",
449         #  actionlabel => 'Enter electronic check refund',
450         #  width       => 440,
451         #  acl         => ['Post refund' ],
452         ##  condition   => sub { $payby{MCHK} },
453         #},
454
455       ],
456
457     },
458
459     { label   => '-',
460       content => '-',
461     },
462
463     {
464       label       => 'Add tax adjustment',
465       popup       => "edit/cust_tax_adjustment.html?custnum=$custnum",
466       actionlabel => 'Add tax adjustment',
467       height      => 200,
468       confexists  => 'enable_tax_adjustments',
469       acl         => 'Add customer tax adjustment',
470     },
471
472     { label       => '-',
473       content     => '-',
474       confexists  => 'enable_tax_adjustments',
475       acl         => 'Add customer tax adjustment',
476     },
477
478     {
479       label       => 'Email statement to this customer',
480       url         => sub {
481                       my $cust_main = shift;
482                       my $agentnum = $cust_main->agentnum;
483                       'misc/email-customer-statement.html?table=cust_main;'.
484                       'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
485                       uri_escape($cgi->self_url);
486                      },
487       condition   => sub { $invoicing_list_emailonly },
488       acl         => 'Resend invoices',
489     },
490     {
491       label       => 'Download PDF statement',
492       url         => "view/cust_main_statement-pdf.cgi?$custnum",
493       acl         => 'View legacy typeset statements',
494       condition   => sub {
495         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
496       },
497     },
498     {
499       label       => 'Search invoices',
500       url         => "search/report_cust_bill.html?custnum=$custnum",
501       acl         => 'List invoices',
502     },
503     {
504       label       => 'View tax exemptions',
505       url         => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
506       acl         => 'View customer tax exemptions',
507     },
508     {
509       label       => 'View tax adjustments',
510       url         => "search/cust_tax_adjustment.html?custnum=$custnum",
511       confexists  => 'enable_tax_adjustments',
512       acl         => 'Add customer tax adjustment',
513     },
514     {
515       label       => 'View pending payments',
516       url         => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
517       acl         => 'View pending payments',
518       condition   => sub { 
519         FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
520       },
521     },
522
523   ],
524   [
525     {
526       label => 'Change History',
527       show  => 'change_history',
528       acl   => 'View customer history',
529     },
530   ],
531 );
532
533 </%init>