rt# 74031 work in progress
[freeside.git] / httemplate / elements / tr-select-realestate_unit.html
diff --git a/httemplate/elements/tr-select-realestate_unit.html b/httemplate/elements/tr-select-realestate_unit.html
new file mode 100644 (file)
index 0000000..00c568e
--- /dev/null
@@ -0,0 +1,40 @@
+<%doc>
+
+Display a pair of select boxes for provisioning a realestate_unit
+- Real Estate Location
+- Real Estate Unit
+
+</%doc>
+<& tr-td-label.html, %opt &>
+<td>
+<& select-tiered.html,
+  'tiers' => [
+    {
+      # (todo) need to filter out locations where all units are assigned
+      field         => 'realestate_location',
+      table         => 'realestate_location',
+      #extra_sql     => "WHERE $classnum_sql",
+      name_col      => 'location_title',
+      empty_label   => '(all)',
+    },
+    {
+      field         => 'realestate_unit',
+      table         => 'realestate_unit',
+      name_col      => 'unit_title',
+      value_col     => 'realestatenum',
+      link_col      => 'realestatelocnum',
+      #extra_sql     => delete($opt{'extra_sql'}),
+      # Need to add a filter to filter-out assigned units (todo)
+      disable_empty => 1,
+    },
+  ],
+  %opt,
+  'prefix' => $opt{'prefix'}. $opt{'field'}. '_', #after %opt so it overrides
+&>
+</td>
+</tr>
+<%init>
+
+my %opt = @_;
+
+</%init>