|
|
@@ -29,7 +29,7 @@ pub struct ZonesView {
|
|
|
pending_delete_id: Option<i32>,
|
|
|
pending_parent_id: Option<i32>, // For "Add Child Zone"
|
|
|
// Navigation request
|
|
|
- pub switch_to_inventory_with_zone: Option<String>, // zone_code to filter by
|
|
|
+ pub switch_to_inventory_with_zone: Option<(String, i64)>, // (zone_code, zone_id) to filter by
|
|
|
// Print dialog
|
|
|
print_dialog: Option<crate::core::print::PrintDialog>,
|
|
|
show_print_dialog: bool,
|
|
|
@@ -115,7 +115,7 @@ impl ZonesView {
|
|
|
EditorField {
|
|
|
name: "id".into(),
|
|
|
label: "ID".into(),
|
|
|
- field_type: FieldType::Text,
|
|
|
+ field_type: FieldType::Number,
|
|
|
required: false,
|
|
|
read_only: true,
|
|
|
},
|
|
|
@@ -130,7 +130,7 @@ impl ZonesView {
|
|
|
name: "zone_code".into(),
|
|
|
label: "Full Zone Code".into(),
|
|
|
field_type: FieldType::Text,
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
read_only: false,
|
|
|
},
|
|
|
EditorField {
|
|
|
@@ -164,7 +164,7 @@ impl ZonesView {
|
|
|
EditorField {
|
|
|
name: "audit_timeout_minutes".into(),
|
|
|
label: "Audit Timeout (minutes)".into(),
|
|
|
- field_type: FieldType::Text,
|
|
|
+ field_type: FieldType::Number,
|
|
|
required: false,
|
|
|
read_only: false,
|
|
|
},
|
|
|
@@ -202,7 +202,7 @@ impl ZonesView {
|
|
|
name: "zone_code".into(),
|
|
|
label: "Full Zone Code".into(),
|
|
|
field_type: FieldType::Text,
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
read_only: false,
|
|
|
},
|
|
|
EditorField {
|
|
|
@@ -236,7 +236,7 @@ impl ZonesView {
|
|
|
EditorField {
|
|
|
name: "audit_timeout_minutes".into(),
|
|
|
label: "Audit Timeout (minutes)".into(),
|
|
|
- field_type: FieldType::Text,
|
|
|
+ field_type: FieldType::Number,
|
|
|
required: false,
|
|
|
read_only: false,
|
|
|
},
|
|
|
@@ -498,9 +498,9 @@ impl ZonesView {
|
|
|
// Sort children lists by zone_code
|
|
|
for list in children.values_mut() {
|
|
|
list.sort_by(|a, b| {
|
|
|
- a.get("zone_code")
|
|
|
- .and_then(|v| v.as_str())
|
|
|
- .cmp(&b.get("zone_code").and_then(|v| v.as_str()))
|
|
|
+ let code_a = a.get("zone_code").and_then(|v| v.as_str()).unwrap_or("");
|
|
|
+ let code_b = b.get("zone_code").and_then(|v| v.as_str()).unwrap_or("");
|
|
|
+ code_a.cmp(code_b)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -730,7 +730,7 @@ impl ZonesView {
|
|
|
.clicked()
|
|
|
{
|
|
|
// Set the flag to switch to inventory with this zone filter
|
|
|
- self.switch_to_inventory_with_zone = Some(code.to_string());
|
|
|
+ self.switch_to_inventory_with_zone = Some((code.to_string(), id as i64));
|
|
|
ui.close();
|
|
|
}
|
|
|
if ui
|
|
|
@@ -777,15 +777,8 @@ impl ZonesView {
|
|
|
|
|
|
// Clear identifiers and codes that must be unique
|
|
|
clone_map.remove("id");
|
|
|
- clone_map.insert(
|
|
|
- "zone_code".to_string(),
|
|
|
- serde_json::Value::String(String::new()),
|
|
|
- );
|
|
|
- // Mini code is required but typically unique — leave empty to force user choice
|
|
|
- clone_map.insert(
|
|
|
- "mini_code".to_string(),
|
|
|
- serde_json::Value::String(String::new()),
|
|
|
- );
|
|
|
+ // Keep zone_code and mini_code as requested, so user can easily modify them
|
|
|
+ // for similar zones (e.g. multi-story buildings)
|
|
|
|
|
|
// Convert parent_id to string for dropdown if present
|
|
|
if let Some(p) = clone_map.get("parent_id").cloned() {
|