Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contact_address_app/fixtures/client_script.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"doctype": "Client Script",
"dt": "Address",
"enabled": 1,
"modified": "2025-03-28 23:55:43.035109",
"modified": "2025-04-29 00:20:41.803213",
"module": null,
"name": "Map location",
"script": "frappe.ui.form.on(\"Address\", {\n map: function (frm) {\n let map_data = frm.doc.map;\n if (!map_data) return;\n\n try {\n let jsonData = JSON.parse(map_data);\n let coordinates = jsonData.features[0].geometry.coordinates;\n let lon = coordinates[0], lat = coordinates[1];\n\n frappe.call({\n method: \"contact_address_app.api.get_address_from_coordinates\",\n args: { lat: lat, lon: lon },\n callback: function (r) {\n if (r.message) {\n frm.set_value(\"road\", r.message.road || \"N/A\");\n frm.set_value(\"suburb\", r.message.suburb || \"N/A\");\n frm.set_value(\"city\", r.message.city || \"N/A\");\n frm.set_value(\"state\", r.message.state || \"N/A\");\n frm.set_value(\"county\", r.message.county || \"N/A\");\n frm.set_value(\"country\", r.message.country || \"N/A\");\n frm.set_value(\"pincode\", r.message.pincode || \"N/A\");\n frm.set_value(\"country_code\", r.message.country_code || \"N/A\");\n frm.set_value(\"plus_code\", r.message.plus_code || \"N/A\"); // Set the Plus Code field\n }\n }\n });\n } catch (e) {\n console.error(\"Error parsing map data:\", e);\n }\n }\n});",
"script": "frappe.ui.form.on(\"Address\", {\n custom_map: function (frm) {\n let map_data = frm.doc.custom_map;\n if (!map_data) return;\n\n try {\n let jsonData = JSON.parse(map_data);\n let coordinates = jsonData.features[0].geometry.coordinates;\n let lon = coordinates[0], lat = coordinates[1];\n\n frappe.call({\n method: \"contact_address_app.api.get_address_from_coordinates\",\n args: { lat: lat, lon: lon },\n callback: function (r) {\n if (r.message) {\n frm.set_value(\"custom_road\", r.message.custom_road || \"N/A\");\n frm.set_value(\"custom_suburb\", r.message.custom_suburb || \"N/A\");\n frm.set_value(\"city\", r.message.city || \"N/A\");\n frm.set_value(\"state\", r.message.state || \"N/A\");\n frm.set_value(\"county\", r.message.county || \"N/A\");\n frm.set_value(\"country\", r.message.country || \"N/A\");\n frm.set_value(\"pincode\", r.message.pincode || \"N/A\");\n frm.set_value(\"custom_country_code\", r.message.custom_country_code || \"N/A\");\n frm.set_value(\"custom_plus_code\", r.message.custom_plus_code || \"N/A\"); // Set the Plus Code field\n }\n }\n });\n } catch (e) {\n console.error(\"Error parsing map data:\", e);\n }\n }\n});\n",
"view": "Form"
}
]
287 changes: 287 additions & 0 deletions contact_address_app/fixtures/custom_field.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
[
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_suburb",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "address_line1",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Suburb",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-04-28 23:45:04.762452",
"module": null,
"name": "Address-custom_suburb",
"no_copy": 0,
"non_negative": 0,
"options": null,
"permlevel": 0,
"placeholder": null,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_road",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "custom_suburb",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Road",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-04-28 23:45:05.010560",
"module": null,
"name": "Address-custom_road",
"no_copy": 0,
"non_negative": 0,
"options": null,
"permlevel": 0,
"placeholder": null,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_country_code",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "country",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Country Code",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-04-28 23:45:05.275325",
"module": null,
"name": "Address-custom_country_code",
"no_copy": 0,
"non_negative": 0,
"options": null,
"permlevel": 0,
"placeholder": null,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_plus_code",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "custom_country_code",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Plus Code",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-04-28 23:45:05.472827",
"module": null,
"name": "Address-custom_plus_code",
"no_copy": 0,
"non_negative": 0,
"options": null,
"permlevel": 0,
"placeholder": null,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_map",
"fieldtype": "Geolocation",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "disabled",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Map",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2025-04-28 23:45:05.662251",
"module": null,
"name": "Address-custom_map",
"no_copy": 0,
"non_negative": 0,
"options": null,
"permlevel": 0,
"placeholder": null,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
}
]