diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/menu.html | 6 | ||||
-rw-r--r-- | httemplate/elements/select-realestate_location.html | 32 | ||||
-rw-r--r-- | httemplate/elements/select-realestate_unit.html | 59 | ||||
-rw-r--r-- | httemplate/elements/tr-select-realestate_location.html | 17 | ||||
-rw-r--r-- | httemplate/elements/tr-select-realestate_unit.html | 5 |
5 files changed, 118 insertions, 1 deletions
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index defcc494f..0a73d71a6 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -834,6 +834,11 @@ $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_cla || $curuser->access_right('Edit global inventory') || $curuser->access_right('Configuration'); +$config_misc{'Real estate inventory'} = [ $fsurl.'browse/realestate_unit.html', 'Setup real estate inventory' ] + if $curuser->access_right('Edit realestate inventory') + || $curuser->access_right('Edit global inventory') + || $curuser->access_right('Configuration'); + $config_misc{'Upload targets'} = [ $fsurl.'browse/upload_target.html', 'Billing and payment upload destinations' ] if $curuser->access_right('Configuration'); @@ -1038,4 +1043,3 @@ sub submenu { } </%init> - diff --git a/httemplate/elements/select-realestate_location.html b/httemplate/elements/select-realestate_location.html new file mode 100644 index 000000000..001ed3e89 --- /dev/null +++ b/httemplate/elements/select-realestate_location.html @@ -0,0 +1,32 @@ +<%doc> + + Displays a selectbox populated with values from realestate_location. + key: realestate_location.realestatenum + value: realestate_location.location_title + +</%doc> + +<% include( '/elements/select-table.html', + %opt, + table => 'realestate_location', + name_col => 'location_title', + hashref => { 'disabled' => '' }, + value => $select_value, + disable_empty => 1, + ) +%> + +<%init> + +# +# possible todo: +# I'd like to change the behavior of this select based on if +# a new item is being created, or an existing item being edited + +my %opt = @_; +my $select_value = $opt{'curr_value'} || $opt{'value'}; + +# use Data::Dumper qw(Dumper); +# print Dumper(\%opt); + +</%init> diff --git a/httemplate/elements/select-realestate_unit.html b/httemplate/elements/select-realestate_unit.html new file mode 100644 index 000000000..e189d5d99 --- /dev/null +++ b/httemplate/elements/select-realestate_unit.html @@ -0,0 +1,59 @@ +<%doc> + +Display a pair of select boxes for provisioning a realestate_unit +- Real Estate Location +- Real Estate Unit + +NOTE: + Records are always suppresed if + - realestate_location.disabled is set + - realestate_unit is provisioned to a customer [not working] + + If it becomes necessary, an option may be added to the template + to show disabled/provisioned records, but is not yet implemented + +</%doc> +<& select-tiered.html, + 'tiers' => [ + { + + field => 'realestate_location', + table => 'realestate_location', + extra_sql => "WHERE realestate_location.disabled IS NULL " + . " OR realestate_location.disabled = '' ", + name_col => 'location_title', + empty_label => '(all)', + }, + { + field => 'realestatenum', + table => 'realestate_unit', + name_col => 'unit_title', + value_col => 'realestatenum', + link_col => 'realestatelocnum', + + # TODO: Filter units assigned to customers + # SQL below breaks the selectbox... why? + + # Also, can we assume if realestatenum doesn't appear in svc_realestate + # that the realestate_unit is unprovisioned to a customer? What indicator + # should be used to determine when a realestae_unit is not provisioned? + + # addl_from => " + # LEFT JOIN svc_realestate + # ON svc_realestate.realestatenum = realestate_unit.realestatenum + # ", + + #extra_sql => "WHERE svc_realestate.svcnum IS NULL ", + + disable_empty => 1, + debug => 1, + }, + ], + %opt, + 'prefix' => $opt{'prefix'}. $opt{'field'}. '_', #after %opt so it overrides +&> +<%init> + +my %opt = @_; + +</%init> diff --git a/httemplate/elements/tr-select-realestate_location.html b/httemplate/elements/tr-select-realestate_location.html new file mode 100644 index 000000000..1367886ed --- /dev/null +++ b/httemplate/elements/tr-select-realestate_location.html @@ -0,0 +1,17 @@ +<TR> + <TH ALIGN="right"><% $opt{'label'} || 'Real Estate Location' %></TD> + <TD> + <% include( '/elements/select-realestate_location.html', + 'curr_value' => $curr_value, + %opt + ) + %> + </TD> +</TR> + +<%init> + +my %opt = @_; +my $curr_value = $opt{'curr_value'} || $opt{'value'}; + +</%init> diff --git a/httemplate/elements/tr-select-realestate_unit.html b/httemplate/elements/tr-select-realestate_unit.html new file mode 100644 index 000000000..b1a4296d4 --- /dev/null +++ b/httemplate/elements/tr-select-realestate_unit.html @@ -0,0 +1,5 @@ +<& tr-td-label.html, @_ &> +<td> +<& select-realestate_unit.html, @_ &> +</td> +</tr> |