63d5c9abd4b598b3883498f4b75b4be56dc52e52
[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      => 740,
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     },
385
386     # realtime payments via payment.cgi
387     { label   => 'Process payment',
388       submenu => [
389         {
390           label       => 'Process credit card payment',
391           url         => "misc/payment.cgi?payby=CARD;custnum=$custnum",
392           acl         => [ 'Process payment', 'Process credit card payment', ],
393           condition   => sub { $payby{CARD} or $payby{DCRD} },
394         },
395         {
396           label       => 'Process electronic check payment',
397           url         => "misc/payment.cgi?payby=CHEK;custnum=$custnum",
398           acl         => [ 'Process payment', 'Process Echeck payment', ],
399           condition   => sub { $payby{CHEK} or $payby{DCHK} },
400         },
401       ],
402     },
403
404     { label   => '-',
405       content => '-',
406     },
407
408     {
409       label       => 'Enter credit',
410       popup       => "edit/cust_credit.cgi?custnum=$custnum",
411       actionlabel => 'Enter credit',
412       width       => 763,
413       acl         => 'Post credit',
414     },
415     {
416       label       => 'Credit line items',
417       popup       => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
418       actionlabel => 'Credit line items',
419       width       => 968,
420       height      => 575,
421       acl         => 'Credit line items',
422       condition   => sub {
423         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
424       },
425     },
426
427     { label   => '-',
428       content => '-',
429     },
430
431     { label   => 'Enter refund',
432       submenu => [
433
434         {
435           label       => 'Enter check refund',
436           popup       => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
437           actionlabel => 'Enter check refund',
438           width       => 440,
439           acl         => ['Post refund', 'Post check refund'],
440         },
441         {
442           label       => 'Enter cash refund',
443           popup       => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
444           actionlabel => 'Enter cash refund',
445           width       => 392,
446           acl         => ['Post refund', 'Post cash refund'],
447         },
448         #{
449         #  label       => 'Record manual (offline/POS) credit card refund',
450         #  popup       => "edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum",
451         #  actionlabel => 'Enter credit card refund',
452         #  width       => 440,
453         #  acl         => ['Post refund' ],
454         ##  condition   => sub { $payby{MCRD} },
455         #},
456         #{
457         #  label       => 'Record manual (offline/POS) electronic check refund',
458         #  popup       => "edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum",
459         #  actionlabel => 'Enter electronic check refund',
460         #  width       => 440,
461         #  acl         => ['Post refund' ],
462         ##  condition   => sub { $payby{MCHK} },
463         #},
464         {
465            label       => 'Enter electronic check refund',
466            popup       => "edit/cust_refund.cgi?popup=1;payby=CHEK;custnum=$custnum",
467            actionlabel => 'Enter electronic check refund',
468            width       => 440,
469            acl         => ['Post refund' ],
470            condition   => sub {
471              FS::pay_batch->can_handle_electronic_refunds
472            },
473         },
474
475       ],
476
477     },
478
479     { label   => '-',
480       content => '-',
481     },
482
483     {
484       label       => 'Add tax adjustment',
485       popup       => "edit/cust_tax_adjustment.html?custnum=$custnum",
486       actionlabel => 'Add tax adjustment',
487       height      => 200,
488       confexists  => 'enable_tax_adjustments',
489       acl         => 'Add customer tax adjustment',
490     },
491
492     { label       => '-',
493       content     => '-',
494       confexists  => 'enable_tax_adjustments',
495       acl         => 'Add customer tax adjustment',
496     },
497
498     {
499       label       => 'Email statement to this customer',
500       url         => sub {
501                       my $cust_main = shift;
502                       my $agentnum = $cust_main->agentnum;
503                       'misc/email-customer-statement.html?table=cust_main;'.
504                       'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
505                       uri_escape($cgi->self_url);
506                      },
507       condition   => sub { $invoicing_list_emailonly },
508       acl         => 'Resend invoices',
509     },
510     {
511       label       => 'Download PDF statement',
512       url         => "view/cust_main_statement-pdf.cgi?$custnum",
513       acl         => 'View legacy typeset statements',
514       condition   => sub {
515         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
516       },
517     },
518     {
519       label       => 'Search invoices',
520       url         => "search/report_cust_bill.html?custnum=$custnum",
521       acl         => 'List invoices',
522     },
523     {
524       label       => 'View tax exemptions',
525       url         => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
526       acl         => 'View customer tax exemptions',
527     },
528     {
529       label       => 'View tax adjustments',
530       url         => "search/cust_tax_adjustment.html?custnum=$custnum",
531       confexists  => 'enable_tax_adjustments',
532       acl         => 'Add customer tax adjustment',
533     },
534     {
535       label       => 'View pending payments',
536       url         => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
537       acl         => 'View pending payments',
538       condition   => sub { 
539         FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
540       },
541     },
542
543   ],
544   [
545     {
546       label => 'Change History',
547       show  => 'change_history',
548       acl   => 'View customer history',
549     },
550   ],
551 );
552
553 </%init>