Giter Club home page Giter Club logo

location-plugin's People

Contributors

acasar avatar ah94med avatar alxy avatar ametad avatar atellier2 avatar boyfromhell avatar daftspunk avatar eoler avatar gabsource avatar gergo85 avatar grafxflow avatar inalto avatar leocantthinkofaname avatar lucaszdv avatar luketowers avatar octoberapp avatar oscarnevarezleal avatar priitperna avatar ribsousa avatar samgeorges avatar samuell1 avatar strangerpings avatar targetblank avatar theservat avatar vojtasvoboda avatar vosco88 avatar voveson avatar webvpf avatar xyz1123581321 avatar zhiweiwu0425 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

location-plugin's Issues

Undefined index: state_id

I am trying to create a model which implement Location

$address = new Address;
$address->name = "test";
$address->city = "Singapore";
// $address->state = null;
// $address->state_code = null;
$address->state_id = null;
$address->country_code = "SG";
$address->save();

and I just get this error in the console Undefined index: state_id

any idea please?

Upgrade location plugin to choose cities and allow user addition

Hello,

Location plugin is great for countries and states. What about cities? It does not - currently - provide any solution.

I suggest to provide a modification of this plugin for cities.

Of course, the list of global cities could not be maintained in a single drop down! For this, my suggestion is as follows:

The should be a drop down of cities from the table cities. Based on the chosen country and state, there may be a few hundred getting dynamically populated in the drop down from the table cities.

Then, in the drop down, there should be a default "is_pinned" given as "city not listed here" . If the user chooses the value "city not listed here", A NEW TEXT FIELD SHOULD BE GENERATED (Ajax) in the

placeholder to allows an user to enter his choice of city that is not in the drop down.

Currently, a user directly inputs the city name as a string that is stored in the database. Thus, there is no city_id in there but only city_name.

If the user chooses a city, the value city_id > 0; and city_name = NULL;

If the choice is == "city not listed here", then the value of city_id = 0; and city_name = NameOfTheCity;

With this system, there is a possibility to dynamically grow the cities table, depending on each website and at the same time keeping the cities table small. Further, it also allows an admin to change the value of cities for a particular user at a later date by moving from the following:

city_name = NameOfTheCity ---> city_id = 215; // where 215 is the real value of that city

Like this, the table could be extended and more cities could be added.

If this feature is not implemented, certain things may remain inconsistent.

October repository gateway issue

Hy, can you fix this please:

Problem 1
- Root composer.json requires rainlab/location-plugin v1.2.1.1, it is found rainlab/location-plugin[v1.2.1.1] in the lock file and rainlab/location-plugin[dev-master, v1.0.8, ..., v1.2.2] from composer repo (https://gateway.octobercms.com) but these do not match your constraint and are therefore not installable. Make sure you either fix the constraint or avoid updating this package to keep the one from the lock file.

Add the ability to search by establishment names

Hi Samuel,

I was wondering wether we could change this one line to the following:

types: ['geocode','establishment']

This way, we could also search by establishment name. This would make sense because sometimes you don't know the address of the place you're looking up the address for, and by entering the name of the venue, the address would appear automatically.

Taking this one step further would be to add a mappable field for the establishment name (like country, country-long... etc).
Would you consider this if I do a pull request?

Thanks in advance.

Migration for other countires. Are they required?

This is more a question of are migrations needed for the other country states/districts etc?

I have been going through the epic task of getting all the existing countires states/districts from wikipedia (ISO_3166-2:??). Would anybody want me to create migrations for this plugin?

Only issue I can see if anybody has already been adding them manually - there will be conflict with existing records id's etc

Get state id after initially seeing up country id in modal popup.

I am doing a user account address edit in a popup modal and setting the country id and state id with the following.

$('#accountCountry').val(res.country.id);
$('#accountState').val(res.state.id);

The active/selected state of the country is fine, but is there a way to initiate the 'onInit' when the modal popups to refresh the state dropdown and set the active state using state.id?

Having problem display address finder field

I've tried to add the address finder form widget to the fields.yaml on my backend form of my model, but it says unknown control type.
selection_012

The model implement RainLab.Location.Behaviors.LocationModel behavior as said on the plugin documentation.

feature request: Geolocation twig

Is your feature request related to a problem? Please describe.
The Request is not related to a Problem, Just a new feature.

Describe the solution you'd like
i like t see a Geolocation feature, where we can user a twig {{ geolocation }} that sets te live GPS latitude longitude.

Describe alternatives you've considered
I tried to code it myself, but my knowledge of javascript is not that great, I myself had created a geolocation.js that provides the location, it generates id="geolocation" but i want to use it as a twig {{ geolocation }}

Using Location plugin throws an error on filters on OctoberCMS v3.5.14

Please refer to this topic on October Talk.
https://talk.octobercms.com/t/using-rainlabs-location-plugin-throws-an-error-on-filters/2224

Hello,

I have a project that depends on countries in their entries. So, I used Rainlab’s Locations plugin; it worked fine in terms of showing the countries in a dropdown, selecting them, and even showing them in the data table. However, when filtering by country, an error gets thrown as shown:

"Call to a member function methodExists() on null" on line 237 of /Users/salahassi/dev/sada/october/modules/backend/filterwidgets/Group.php

The error is here at line 237 ($model is null):
image

And here is how I define it in the Tailor Blueprint:

    country:
        label: Country
        type: dropdown
        options: RainLab\Location\Behaviors\LocationModel::getCountryOptions
        select: name
        placeholder: Select an option

I tried to create a custom scope with no luck.

I appreciate any solution or workaround that might help.

Thanks

Sync location to shipping prices.

I am wanting to sync the country with a different shipping cost. Is there already something like this is place or will I need to add a new column on the location database and sync it in with the relavant shipping cost?

Bad request when used with reCaptcha

When you add a reCaptcha in the same form, the Ajax request gets refused by Google Validator.
Returns status code : 406 Not Acceptable

and JSON response :
{result: "{"input_request":"g-recaptcha-response","message":"Select captcha"}"}

Addressfinder for city field displays short name instead of long name

  1. Create addressfinder field.
  2. Connect city field for address field.
  3. Type "Dortmund, Germany" in addressfinder field.
  4. The city field will be autofilled with value: "DO" instead of "Dortmund".

When I changed this line:

https://github.com/rainlab/location-plugin/blob/master/formwidgets/addressfinder/assets/js/location-autocomplete.js#L202

to "long_name" it seems to work as expected, but I don't know if this change don't break something else.

Extra country/state field

Hi.
I have the country and state fields set in my user table and the plugin works fine.
I want to add additional seasonal_country and seasonal_state fields to my user table (model extended) and edit as normal in the backend. Can you give me sime pointers? I can add them as relations OK, but i can't get the dependsOn functionality working for the state.
Thank-you.

Front-End Dropdown Value Code, Not ID #

I need to pass the country and state name to a process once a front-end form is submitted, but I am given the country and state IDs (ie 3 and 4) instead of the codes (ie US and Nebraska). Is there a conversion I can use?

Front end partial is not passing through selected countryId to the refreshed partial on country selection.

I've extended the user plugin with a 'Profile' model with a few more fields (including the location fields) and a one-to-one relationship. I have a partial named 'country-state' with the following content:

{% set countryId = countryId|default(form_value('profile[country_id]')) %}
{% set stateId = stateId|default(form_value('profile[state_id]')) %}

<div class="form-group">
    countryId: {{ countryId }}
    <label for="accountCountry">Country</label>
    {{ form_select_country('country_id', countryId, {
        id: 'accountCountry',
        class: 'form-control',
        emptyOption: 'Select country (optional)',
        'data-request': 'onInit',
        'data-request-update': {
            (__SELF__ ~ '::country-state'): '#partialCountryState'
        }
    }) }}
</div>

<div class="form-group">
    <label for="accountState">State</label>
    {{ form_select_state('state_id', countryId, stateId, {
        id: 'accountState',
        class: 'form-control',
        emptyOption: 'Select county/state (optional)'
    }) }}
</div>

My partial is in the form like this:

<div id="partialCountryState">
    {% partial '@country-state' countryId=user.profile.country_id stateId=user.profile.state_id %}
</div>

It all renders correctly but when I select a country, the two dropdowns are empty and countryId is non-existent if I print it out.

Howto make addressfinder to populate country and state dropdown

Hello,

I'm creating a plugin based on the location plugin.

I could successfully create my different address fields (street, zip, city, etc...) with country and state as a relation provided by this plugin. Everything works well.

Now I would like to add the addressfinder widget on the top of my form to automatically populate all the fields if you find an address using this widget.

It works for all textfield elements, but not with the country and state dropdown. How can I fix that ?

Thanks

API Key Required?

Not sure why no one else is (apparently) having this issue, but the geocoding address lookup function does not work unless you include the Google Maps API Key in the javascript include.

$this->addJs('//maps.googleapis.com/maps/api/js?libraries=places&key=[YOUR_API_KEY]');

I wonder if I am just being asked for an API key for unknown reasons and no one else is? Perhaps a policy update at Google? If it's happening to everyone perhaps I or someone else can add the needed settings functionality to prevent people from having to change the source.

City Model

It's very useful if you put the city model under the state model since city is mostly used for displaying location. If you want, I can contribute to this plugin.

Thanks,

United Kingdom Incomplete

The whole of the UK is not included in the database. Northern Ireland is completely missing, only England, Scotland and Wales are included. Means that this plugin in its current state is unusable.

country_name won't display country name

I've extended the location plugin for a plugin I'm developing. My issue is that in the yaml columns file, I'm unable to display the country name.

I can do country to display all of the database information for that country. I can do country_id to display the id number. I can even do country_code to display the country code of the country.

However, what I can't do is country_name (the name of the db field) to pull the country name.

I have no idea why this isn't working, but it would be delightful if it would. Any help is greatly appreciated!

Thanks!

issue with geocoding

hello,
i encountered an issue working with the plugin and the geocoding from GoogleAPI, i was looking up countries using their names it was working fine until one of the entries was Palestine which is named "Palestinian territory, occupied" which doesn't exist on google API, so i renamed it to "Palestine" on my countries BD table and now it works fine.
P.S there is also a couple of states missing on the middle east area.

Default value for country_id

Hy, please add null as default value for country_id in state model, i am having this error when i use firstOrCreate

SQLSTATE[HY000]: General error: 1364 Field 'country_id' doesn't have a default value

thanks

Location AutoComplete AddressFinder widget Error

location-autocomplete.js?vb60e7aba:123 Uncaught TypeError: Cannot read properties of undefined (reading 'location')
    at LocationAutocomplete.handlePlaceChanged (location-autocomplete.js?vb60e7aba:123:42)
    at Lr.i (jquery.min.js?v=b60e7aba:2:87491)
    at lf.jr (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:260:352)
    at Object._.F.trigger (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:256:473)
    at pf (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:93:322)
    at pf (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:93:304)
    at E$._.G.set (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:262:758)
    at E$.Eo (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:101:347)
    at E$._.n.lx (places_impl.js:68:200)
    at lf.jr (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:260:352)
    at J$._.F.trigger (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:256:473)
    at J$.<anonymous> (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:91:388)
    at lf.jr (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:260:352)
    at Object._.F.trigger (js?libraries=places&key=AIzaSyBZQTH-OhwCY-9-JYfT5053c7iBoeI2_rA:256:473)
    at $pb (places_impl.js:36:132)
    at J$._.n.Ow (places_impl.js:72:298)

addressfinder in plugin settings

Hi,

So I registered settings for my plugin with registerSettings() and tried to put an addressfinder widget inside the form.yaml of my plugin's settings.

But all I get is Call to undefined method System\Controllers\Settings::formGetWidget()

Can you help me ?
Thanks.

Here's what inside my form.yaml :

        address:
            label: Address
            type: addressfinder
            tab: Contact details
            fieldMap:
                street: address_street
                city: address_city
                zip: address_zipcode
                latitude: latitude
                longitude: longitude
        address_street:
            type: text
            label: Address Street & Number
            span: full
            tab: Contact details
        address_zipcode:
            label: Zipcode
            type: text
            span: left
            tab: Contact details
        address_city:
            type: text
            label: City
            span: right
            tab: Contact details
        latitude:
            type: text
            label: Latitude
            span: left
            tab: Contact details
        longitude:
            type: text
            label: Longitude
            span: right
            tab: Contact details

LocationModel behavior incompatible with $guarded fields

After a debugging session, I figured out why my model was not being updated correctly. In my model, I had not defined a $fillable array. I generally opt for setting $guarded fields in stead:

protected $guarded = [];

It turns out that when your model implements the LocationModel behavior, that sets an array of fillable properties, which is not compatible with the above. I'd propose the following fix in the LocationModel constructor:

/**
 * Constructor
 */
public function __construct($model)
{
    parent::__construct($model);

    if (!empty($model->getFillable())) {
        $model->addFillable([
            'country',
            'country_id',
            'country_code',
            'state',
            'state_id',
            'state_code'
        ]);
    }

    $model->belongsTo['country'] = ['RainLab\Location\Models\Country'];
    $model->belongsTo['state']   = ['RainLab\Location\Models\State'];
}

This way, if the model does define $fillable properties, the location properties are added as fillable. If not, they would be fillable by default unless the developer explicitly blacklists them using the $guarded array.

I have created a PR (#53) to implement the above.

Problem trying to render a partial with the countries and states

I'm having a problem trying to render a partial with the countries and states on the front end as per plungin docs, Front-end usage.

When I change the country in select it simply does not load the data with the country and states of it, it does not show any error.

See the pictures:

Country and states render!
country and states render

Change country in select country and states not render!
change country in select country and states not render

RainLab\Location\Models\Country::getNameList not translated

Because of the lists method on QueryBuilder, the names are not translated using Country::getNameList . I temporarly fixed it using the code below. But I think there could be a better solution I overlook.

    public static function getNameList()
    {
        if (self::$nameList) {
            return self::$nameList;
        }

        $countries = self::isEnabled()->orderBy('is_pinned', 'desc')->orderBy('name', 'asc')->get();

        $countriesById = [];
        foreach ($countries as $country) {
            $countriesById[$country->id] = trim($country->name);
        }

        // Sort again due translations
        asort($countriesById);

        return self::$nameList = $countriesById;
    }

addressfinder not working in a Relation popup

Hello,

does the addressfinder field work with relation popup forms? I can't seem to get the auto fill inputs to work but not sure if it's the fieldMap. It's difficult to debug or dump data with popups so not sure where I'm going wrong. The actual search function works, just not the input auto fill as I said.

Thanks!

Unable to install Plugin on Fresh OCMS install

I have just installed OctoberCMS using the development Docker containers provided by Rainlab. Everything is peachy, but when I attempt to install this plugin, I get the error:

    - Root composer.json requires october/all ^3.0, found october/all[v3.0.0, ..., 3.4.x-dev] but the package is fixed to 9999999-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

This was from running:

php artisan plugin:install Rainlab.Location

Is this something you can help with?

Google places javascript blocked in SSL mode

The formwidget AddressFinder loads the Google Places js library on a non-secure address:

https://github.com/rainlab/location-plugin/blob/master/formwidgets/AddressFinder.php#L83

$this->addJs('http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false');

But on a website in SSL mode (https) is this library blocked by modern webbrowsers, because of:

Mixed Content: The page at 'https://www.......' was loaded over HTTPS, but requested an insecure script 'http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false'. This request has been blocked; the content must be served over HTTPS.

Also: Google Maps API warning: SensorNotRequired
The parameter 'sensor=false' is not required anymore.

Shipping Fee table doesn't exist

"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shipping_fee' in 'field list' (SQL: update rainlab_location_countries set is_enabled = 0, shipping_fee = 100.09 where id = 1)" on line 669 of /home/hospit/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.