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