[Fix]Quick entry with geolocation field issue fix (#6662)

* Quick entry with geolocation field issue fix

* Codacy issue fix
This commit is contained in:
Deepesh Garg 2018-12-24 13:06:30 +05:30 committed by Rushabh Mehta
parent 1d461ab5cc
commit ed80e9dff1
2 changed files with 16 additions and 1 deletions

View file

@ -12,6 +12,17 @@ frappe.ui.form.ControlGeolocation = frappe.ui.form.ControlCode.extend({
);
this.map_area.prependTo($input_wrapper);
this.$wrapper.find('.control-input').addClass("hidden");
if ($input_wrapper.is(':visible')) {
this.make_map();
} else {
$(document).on('quick-entry-dialog-open', () => {
this.make_map();
});
}
},
make_map() {
this.bind_leaflet_map();
this.bind_leaflet_draw_control();
this.bind_leaflet_locate_control();
@ -19,6 +30,7 @@ frappe.ui.form.ControlGeolocation = frappe.ui.form.ControlCode.extend({
},
format_for_input(value) {
if (!this.map) return;
// render raw value from db into map
this.clear_editable_layers();
if(value) {
@ -52,7 +64,6 @@ frappe.ui.form.ControlGeolocation = frappe.ui.form.ControlCode.extend({
},
bind_leaflet_map() {
var circleToGeoJSON = L.Circle.prototype.toGeoJSON;
L.Circle.include({
toGeoJSON: function() {

View file

@ -116,6 +116,10 @@ frappe.ui.form.QuickEntryForm = Class.extend({
this.dialog.onhide = () => frappe.quick_entry = null;
this.dialog.show();
this.dialog.$wrapper.on('shown.bs.modal', function() {
$(document).trigger('quick-entry-dialog-open');
});
this.dialog.refresh_dependency();
this.set_defaults();