Google Map integration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JacerOmri
    Junior Member
    • May 2015
    • 5

    Google Map integration

    Hello,

    I'm trying to make a new entity with latitude and longitude fields. I couldn't know where to start to add a map to the edit view and bind its markers lat and lng to the fields in the entity (pure js).

    any help?
  • yuri
    Member
    • Mar 2014
    • 8521

    #2
    Hi

    I need to create a new field view. There are a lot of examples in the EspoCRM. Specify view class in entityDefs.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • JacerOmri
      Junior Member
      • May 2015
      • 5

      #3
      ok it felt as if i kinda started getting it, you mean like

      "views":{
      "detail":"Crm:Meeting.Detail"
      },
      "recordViews":{

      until i couldn't understand how to create my own, am i missing the docs (i couldn't find any)?

      Comment

      • JacerOmri
        Junior Member
        • May 2015
        • 5

        #4
        so the question becomes, how can i create a new field type?
        Last edited by JacerOmri; 05-08-2015, 04:49 PM.

        Comment

        • yuri
          Member
          • Mar 2014
          • 8521

          #5
          application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json

          There is "view": "Crm:Case.Fields.Contact"

          If you specify "view": "Custom:Case.Fields.Contact" it will mean clients/custom/res/views/case/fields/contact.js directory

          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • JacerOmri
            Junior Member
            • May 2015
            • 5

            #6
            Thank you yurikuzn for your help,
            I spent some time reading the source code trying to understand it.
            As far as i went, i think i need a .tpl file to actually show the map (the div#map that will hold the map) and initialize it in the field's javascript code.

            I also noticed that i would use 'jsonObject' as field type and store lat and lng inside it, rather than creating two float fields and changing their value.

            if my guess about the .tpl file is right, can i get any guidance to make it?

            please correct me if i'm wrong, i tried to write down what i could understand, and i would be grateful if you correct me.

            Comment

            • yuri
              Member
              • Mar 2014
              • 8521

              #7
              clients/custom/src/views/contact/fields/map.js
              PHP Code:
              Espo.define('Custom:Views.Contact.Fields.Map', 'Views.Fields.Base', function (Dep) {
              
                  return Dep.extend({
              
                       template: 'custom:contact.fields.map', // means clients/custom/res/templates/contact/map.tpl,
              
              
                     afterRender: function () {
                           // your code
                     },
                
                  });
              }) 
              



              I'd rather use two float fields instead of jsonObject.
              If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

              Comment

              Working...