{
  "doctype": "Page",
  "name": "route-planner",
  "page_name": "route-planner",
  "title": "Route Planner",
  "module": "Westech R2",
  "standard": "Yes",
  "roles": [
    {
      "role": "All"
    }
  ],
  "script": "frappe.pages[\"route-planner\"].on_page_load = function(wrapper) {\n    var page = frappe.ui.make_app_page({\n        parent: wrapper,\n        title: \"Route Planner\",\n        single_column: true\n    });\n    \n    frappe.call({\n        method: \"westech_r2.api.optimize_routes.get_scheduled_pickups\",\n        callback: function(r) {\n            if (r.message) {\n                renderRoutePlanner(page, r.message);\n            }\n        }\n    });\n    \n    function renderRoutePlanner(page, data) {\n        var h = \"<div style='padding:20px;'>\";\n        h += \"<h2>Route Planner</h2>\";\n        h += \"<p>Schedule and optimize pickup routes.</p>\";\n        h += \"<div id='route-map' style='width:100%;height:400px;background:#f0f0f0;margin:20px 0;'></div>\";\n        h += \"<button class='btn btn-primary' id='optimize-btn'>Optimize Routes</button>\";\n        h += \"<div id='routes-container' style='margin-top:20px;'></div>\";\n        h += \"</div>\";\n        $(page.body).html(h);\n        \n        $(\"#optimize-btn\").on(\"click\", function() {\n            frappe.call({\n                method: \"westech_r2.api.optimize_routes.optimize_routes\",\n                callback: function(r) {\n                    if (r.message) {\n                        frappe.show_alert({message: \"Routes optimized\", indicator: \"green\"});\n                    }\n                }\n            });\n        });\n    }\n};\n"
}