So i've been struggling for a week to make this happen!!!!
In short, my structure is as follows :
Address = new SimpleSchema({
location: {
type: Object
},
fullAddress: {
type: String
},
country: {
type: String
},
governorate: {
type: String
},
city: {
type: String
},
street: {
type: String
},
building: {
type: Number
}
});
Branch = new SimpleSchema({
address: {
type: Address
},
....
});
Companies = new Mongo.Collection('companies');
CompanySchema = new SimpleSchema({
branch: {
type: [Branch],
minCount: 1
},
....
});
Companies.attachSchema(CompanySchema);
As you can see, I have an array of branches, with all branch has an address & location.
I want to be able to show a map for each [Branch]/Address when calling autoform like:
{{> quickForm collection="Companies" type="insert" id="company_form"}}
Then, have some map click listener to place a marker, and then reverse geoDecode location to populate the address fields
I have tried following yogiben:autoform-map, but the package is incomplete (has MyLocation button issues zoom exceptions, and cannot show multiple maps per page) thus, cannot be used in production.
I am disparate...Please help!
So, I created my own solution, and I'll share it to benefit any one having the same issue.
I modified yogiben/meteor-autoform-map and added a pull request adding geoCoding feature along with a lot of other stuff.
The following is my current autoform configurations & handling:-
Schema
client/main.js
Hope that helps anyone.
Feel free to inquire any elaborations