clean up package list UI: put actions in a dropdown
authorIvan Kohler <ivan@freeside.biz>
Fri, 11 Nov 2016 06:45:36 +0000 (22:45 -0800)
committerIvan Kohler <ivan@freeside.biz>
Fri, 11 Nov 2016 06:45:36 +0000 (22:45 -0800)
httemplate/view/cust_main/packages/contact.html
httemplate/view/cust_main/packages/location.html
httemplate/view/cust_main/packages/package.html

index 88f8afb..8c59615 100644 (file)
         </FONT>
 %    }
     <BR>
         </FONT>
 %    }
     <BR>
-% } elsif ( $show_contact_link && ! $opt{no_links} ) {
-    <FONT SIZE=-1>
-      (&nbsp;<%pkg_add_contact_link($cust_pkg)%>&nbsp;)
-    </FONT>
-    <BR>
 % }
 <%init>
 
 % }
 <%init>
 
@@ -31,10 +26,6 @@ my $show_detach_link =
   ! $cust_pkg->get('cancel')
   && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');
 
   ! $cust_pkg->get('cancel')
   && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');
 
-my $show_contact_link =
-  ! $cust_pkg->get('cancel')
-  ; #&& $FS::CurrentUser::CurrentUser->access_right('Add package contact'); #or something like that
-
 my $contact = $cust_pkg->contact_obj;
 
 sub pkg_change_contact_link {
 my $contact = $cust_pkg->contact_obj;
 
 sub pkg_change_contact_link {
@@ -50,19 +41,6 @@ sub pkg_change_contact_link {
   );
 }
 
   );
 }
 
-sub pkg_add_contact_link {
-  my $cust_pkg = shift;
-  #my $pkgpart = $cust_pkg->pkgpart;
-  include( '/elements/popup_link-cust_pkg.html',
-    'action'      => $p. "misc/change_pkg_contact.html",
-    'label'       => emt('Add contact'),
-    'actionlabel' => emt('Add contact'),
-    'cust_pkg'    => $cust_pkg,
-    'width'       => 616,
-    'height'      => 192,
-  );
-}
-
 sub pkg_detach_link {
   my $cust_pkg = shift;
   #my $pkgpart = $cust_pkg->pkgpart;
 sub pkg_detach_link {
   my $cust_pkg = shift;
   #my $pkgpart = $cust_pkg->pkgpart;
index 595d6b3..b855e6a 100644 (file)
@@ -19,7 +19,7 @@
 %     if ( $loc->latitude && $loc->longitude ) {
           <BR>
           <FONT SIZE=-1>
 %     if ( $loc->latitude && $loc->longitude ) {
           <BR>
           <FONT SIZE=-1>
-          <% $loc->latitude %>, <% $loc->longitude %>
+          <!-- <% $loc->latitude %>, <% $loc->longitude %> -->
           <& /elements/coord-links.html, {
                'latitude'        => $loc->latitude,
                'longitude'       => $loc->longitude,
           <& /elements/coord-links.html, {
                'latitude'        => $loc->latitude,
                'longitude'       => $loc->longitude,
 %   } # all of this is hidden if packages are grouped by location, because
 %     # it's in the top banner
 
 %   } # all of this is hidden if packages are grouped by location, because
 %     # it's in the top banner
 
-%   if ( ! $cust_pkg->get('cancel')
-%      && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
-%     )
-%   {
-  <BR>
-  <FONT SIZE=-1>
-%     unless ( $opt{no_links} or $opt{'change_from'} ) {
-      (&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
-%     }
-%     if ( $cust_pkg->locationnum && ! $opt{no_links} ) {
-        (&nbsp;<%pkg_edit_location_link($cust_pkg->locationnum)%>&nbsp;)
-%     }
-  </FONT>
-%   } 
 % } # if the package is a scheduled future package change without location
 %   # change, then don't show any of this at all.  It's all implied by the
 %   # preceding package.
 % } # if the package is a scheduled future package change without location
 %   # change, then don't show any of this at all.  It's all implied by the
 %   # preceding package.
@@ -80,30 +66,4 @@ my $loc = $cust_pkg->cust_location_or_main('_cache'=>$opt{cust_location_cache});
 # dubious--they should all have a location now
 my $default = $cust_pkg->locationnum == $opt{'cust_main'}->ship_locationnum;
 
 # dubious--they should all have a location now
 my $default = $cust_pkg->locationnum == $opt{'cust_main'}->ship_locationnum;
 
-sub pkg_change_location_link {
-  my $cust_pkg = shift;
-  my $pkgpart = $cust_pkg->pkgpart;
-  include( '/elements/popup_link-cust_pkg.html',
-    'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
-                     "address1=;address2=;city=;county=;state=$statedefault;".
-                     "zip=;country=$countrydefault",
-    'label'       => emt('Change location'),
-    'actionlabel' => emt('Change'),
-    'cust_pkg'    => $cust_pkg,
-    'width'       => 960,
-    'height'      => 530,
-  );
-}
-
-sub pkg_edit_location_link {
-  my $locationnum = shift;
-  include( '/elements/popup_link.html',
-    'action'      => $p. "edit/cust_location.cgi?locationnum=$locationnum",
-    'label'       => emt('Edit location'),
-    'actionlabel' => emt('Edit'),
-    'width'       => 700,
-    'height'      => 355,
-   );
-}
-
 </%init>
 </%init>
index 9fed5b5..14f7fb0 100644 (file)
                                     ';clone='. $part_pkg->pkgpart,
                  },
 
                                     ';clone='. $part_pkg->pkgpart,
                  },
 
+                 { label       => '-',
+                   content     => '-',
+                 },
+
                  { label       => 'View package events',
                    acl         => [ 'Billing event reports',
                                     'View customer billing events', ],
                  { label       => 'View package events',
                    acl         => [ 'Billing event reports',
                                     'View customer billing events', ],
                    url         => "search/cust_event.html?$plink",
                  },
 
                    url         => "search/cust_event.html?$plink",
                  },
 
+                 { label       => '-',
+                   condition   => sub { $cust_pkg->exists_cust_event },
+                   content     => '-',
+                 },
+
                  { label       => 'Change quantity',
                    acl         => 'Change customer package',
                    condition   => sub { $part_pkg->freq ne '0'
                  { label       => 'Change quantity',
                    acl         => 'Change customer package',
                    condition   => sub { $part_pkg->freq ne '0'
                    height      => 220,
                  },
 
                    height      => 220,
                  },
 
+                 { label       => '-',
+                   content     => '-',
+                 },
+
                  { label       => (@invoice_detail ? 'Edit' : 'Add').
                                     ' invoice details',
                    acl         => 'Edit customer package invoice details',
                  { label       => (@invoice_detail ? 'Edit' : 'Add').
                                     ' invoice details',
                    acl         => 'Edit customer package invoice details',
 
                  },
 
 
                  },
 
+                 { label       => '-',
+                   condition   => sub { $part_pkg->freq ne '0'
+                                          && ! $change_from
+                                          && ! $cust_pkg->get('cancel')
+                                      },
+                   content     => '-',
+                 },
+
+                 { label       => 'Add contact',
+                   #acl         => 'Add package contact',#or something like that
+                   condition   => sub { ! $cust_pkg->get('cancel') },
+                   popup       => "misc/change_pkg-contact.html?$plink",
+                   actionlabel => emt('Add contact'),
+                   width       => 616,
+                   height      => 192,
+                 },
+
+                 { label       => 'Change location',
+                   acl         => 'Change customer package',
+                   condition   => sub { ! $change_from },
+                   popup       => "misc/change_pkg.cgi?locationnum=-1;$plink;".
+                      "address1=;address2=;city=;county=;state=$statedefault;".
+                      "zip=;country=$countrydefault",
+                   actionlabel => emt('Change location'),
+                   width       => 960,
+                   height      => 530,
+                 },
+
+                 { label       => 'Edit location',
+                   acl         => 'Change customer package',
+                   condition   => sub { ! $change_from && $cust_pkg->locationnum != $cust_pkg->cust_main->ship_locationnum  },
+                   popup       => 'misc/cust_location.cgi?locationnum='.
+                                    $cust_pkg->locationnum,
+                   actionlabel => emt('Edit location'),
+                   width       => 700,
+                   height      => 355,
+                 },
+
                ],
              ],
         &>
                ],
              ],
         &>