clean up package list UI: put actions in a dropdown
[freeside.git] / httemplate / view / cust_main / packages / contact.html
index 5f47cf7..8c59615 100644 (file)
@@ -1,47 +1,66 @@
 % if ( $contact ) {
     <% $contact->line |h %>
+% if ( $show_change_link && ! $opt{no_links} ) {
+        <FONT SIZE=-1>
+          (&nbsp;<%pkg_change_contact_link($cust_pkg)%>&nbsp;)
+        </FONT>
+% }
+% if ( $show_detach_link && ! $opt{no_links} ) {
+        <FONT SIZE=-1>
+          (&nbsp;<%pkg_detach_link($cust_pkg)%>&nbsp;)
+        </FONT>
+%    }
+    <BR>
 % }
-
-% if ( ! $cust_pkg->get('cancel')
-%      && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
-%    )
-% {
-  <FONT SIZE=-1>
-%#XXX    (&nbsp;<%pkg_change_contact_link($cust_pkg)%>&nbsp;)
-%#  %   if ( $cust_pkg->contactnum ) {
-%#          (&nbsp;<%edit_contact_link($cust_pkg->contactnum)%>&nbsp;)
-%#  %   }
-  </FONT>
-% } 
-
 <%init>
 
-my $conf = new FS::Conf;
 my %opt = @_;
 
 my $cust_pkg       = $opt{'cust_pkg'};
 
+my $show_change_link = 
+  ! $cust_pkg->get('cancel')
+  && $FS::CurrentUser::CurrentUser->access_right('Change customer package');
+
+my $show_detach_link =
+  ! $cust_pkg->get('cancel')
+  && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');
+
 my $contact = $cust_pkg->contact_obj;
 
 sub pkg_change_contact_link {
   my $cust_pkg = shift;
-  my $pkgpart = $cust_pkg->pkgpart;
+  #my $pkgpart = $cust_pkg->pkgpart;
   include( '/elements/popup_link-cust_pkg.html',
-#XXX
-    'action'      => $p. "misc/change_pkg.cgi?contactnum=-1",
-    'label'       => emt('Change contact'),
+    'action'      => $p. "misc/change_pkg_contact.html",
+    'label'       => emt('Change'), # contact'),
     'actionlabel' => emt('Change'),
     'cust_pkg'    => $cust_pkg,
+    'width'       => 616,
+    'height'      => 220,
   );
 }
 
-sub edit_contact_link {
-  my $contactnum = shift;
-  include( '/elements/popup_link.html',
-    'action'      => $p. "edit/cust_contact.cgi?contactnum=$contactnum",
-    'label'       => emt('Edit contact'),
-    'actionlabel' => emt('Edit'),
+sub pkg_detach_link {
+  my $cust_pkg = shift;
+  #my $pkgpart = $cust_pkg->pkgpart;
+  include( '/elements/popup_link-cust_pkg.html',
+    'action'      => $p. "misc/detach_pkg.html",
+    'label'       => emt('Detach'),
+    'actionlabel' => emt('Detach'),
+    'cust_pkg'    => $cust_pkg,
+    'width'       => 616,
+    'height'      => 720,
   );
 }
 
+#sub edit_contact_link {
+#  my $contactnum = shift;
+#  include( '/elements/popup_link.html',
+#    'action'      => $p. "edit/cust_contact.cgi?contactnum=$contactnum",
+#    'label'       => emt('Edit contact'),
+#    'actionlabel' => emt('Edit'),
+#  );
+#}
+
 </%init>