Vicente123

Experience

530

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

18th April, 2018

Vicente123 started a new conversation Removing Objects From An Array. • 6 days ago

Hi, Im trying to make a chained select, the functionality is pretty basic. When a user selects a Country I remove from an array of cities objects, the ones that don't match with my selected country. So, I'm actually trying to remove those elements from the Object Array, but i can't. I tried using lodash, common JS, and Jquery. The thing is that the array sustains the same structure as before removing the elements, so it gets rendered at the select.

My code: HTML

<select name="country_selector" id="country_selector" class="form-control" @change="showCities">
                        <option :value="0" disabled placeholder="selected">Selected a Country...</option>
                        <option v-for="country in countries" :value="country.id" :key="country.id">{{ country.name }}</option>
                    </select>

                    <br>

                    <label for="city_selector">City</label>
                    <select name="city_selector" id="city_selector" class="form-control" @change="showSites">
                        <option :value="0" disabled>Selected a City...</option>
                        <option v-for="city in cities" :value="city.id" :key="city.id">{{ city.name }}</option>
                    </select>

Vue code:

data() {
            return {
                mode: 'Loading',
                selected_site: undefined,
                locations: [],
                countries: [],
                cities: [],
                sites: [],
                arrAux: []
            };
        },

etc...

methods: {

showCities(){

               let country_id = $('#country_selector').val();

                this.cities = _.remove(this.cities, function (el) {
                    return el.country_id !== country_id;
                });
            }
}

16th April, 2018

Vicente123 left a reply on Axios.put Retriving "500 (Internal Server Error)" • 1 week ago

@ejdelmonico mmm... that doesn't seems to fix the problem, any other idea?

Vicente123 started a new conversation Axios.put Retriving "500 (Internal Server Error)" • 1 week ago

Hi, I'm trying to update data using axios.put method. It WAS WORKING till I moved the route into some routes group with prefix and middlewares. I'm pretty sure that I'm missing tokens. Code:

´´´ axios.put(self.postUrl.replace('%%ID%%', id), { id: id, title: $('#prov_program_name').val(), description: $('#prov_program_description').val(), session: $('#prov_program_session').val()

            })

´´´

´´´

Route::group(['prefix' => 'rest', 'middleware' => 'auth.basic'], function () { Route::put('/rest/program-instances/update', '[email protected]')->name('rest.program_instances.update');

});

´´´

My form does not have a single token declared. But as i said, it was working before moving this route.

10th April, 2018

Vicente123 started a new conversation Multiple Events For One Listener • 2 weeks ago

Hi, I'm trying to trigger a listener with 2 different Events. (I know that I could use the same event. but that's not the point). So, how do I approach this? I'm using Laravel 5.2, declaring events and listeners at my EventServiceProvider

my EventServiceProvider: ´´´

'App\Events\SecurityDepositPaymentAdded' => [
        'App\Listeners\UpdateSecurityDepositBalance'
    ],

    'App\Events\SecurityDepositChargeAdded' => [
        'App\Listeners\UpdateSecurityDepositBalance'
    ]

´´´

how should my handle look like?

23rd March, 2018

Vicente123 left a reply on Reading JS SessionStorage From Vue Doesn't Works. • 1 month ago

My bad at writing it. I will try those options then

Vicente123 started a new conversation Reading JS SessionStorage From Vue Doesn't Works. • 1 month ago

Hi, I'm trying to make some basic stuff, basically, I want to declare a SessionStorage variable in a page with a form. Then. The user travels to a page with my Vue component where I need to extract that session storage variable. This is how I get the first value in my JS.

var fieldOperator = document.getElementById("operatorForRefundAmount");

fieldOperator.addEventListener("change", function() {
            sessionStorage.setItem("autosaveOperator", fieldOperator.value);
        }); 

That works just fine. The problem is when i try to get that session's value in my vue component. For this, I'm using the vue-sessionstorage package ( https://www.npmjs.com/package/vue-sessionstorage )

Vue code:

etc

mounted() {
            var self = this;
            this.showSession();

            axios.get(this.peUrl)
                .then(function (response) {
                    self.program_experiences = response.data;
                });
        },

..
etc
..

methods:{
            showSession(){
                  let s = this.$session.get("autosaveAmount");
               console.log(s);;
            }
        }

This shows me undefined as if the session didn't exist.

7th March, 2018

Vicente123 left a reply on Trying To Send Form When Select Changes. • 1 month ago

Thx, i finally did it.

Vicente123 left a reply on Trying To Send Form When Select Changes. • 1 month ago

I'm getting this error: _vm.$refs.form.submit is not a function

Looks like it's waiting for a function. Should i submit the form trough a method?

Vicente123 started a new conversation Trying To Send Form When Select Changes. • 1 month ago

I'm trying to send the form's value to a controller. I've read and implemented the following code. The error im getting every time i change the select's value is : "Cannot read property 'form' of null "

<span class="pull-right">
                                            <form method="POST" v-on:submit="update_status(log.id)">

                                                <strong>Change To:</strong>
                                                <select name = "task_status" v-on:change = "self.form.submit()" style="border-radius: 2px; border-color: #0a0a0a;" v-model="log.status">
                                                    <option value="new" >New</option>
                                                    <option value="in-progress">In Progress</option>
                                                    <option value="under-review">Under Review</option>
                                                    <option value="completed">Completed</option>
                                                    <option value="cancelled">Cancelled</option>
                                                </select>
                                            </form>
                                        </span>


---ETC---


        methods: {
             update_status(task_id){
                console.log("damn son");
                this.statusUpdate.replace('%%ID%%',task_id);
            }
        }

5th March, 2018

Vicente123 left a reply on Can't Refere Prop Inside Foreach. • 1 month ago

That worked. Thx so much!

Vicente123 left a reply on Can't Refere Prop Inside Foreach. • 1 month ago

@m-rk thx, that works. But for some reason, the component doesn't render information as if I hardcoded the wished ID instead of using media_id. Weird...

Vicente123 started a new conversation Can't Refere Prop Inside Foreach. • 1 month ago

So, i'm trying to check the a variable from a foreach with a prop variable. Everything is cool until I try to get the prop's value inside the foreach function. The error im getting: Cannot read property 'media_id' of undefined

Code goes like this:

props: ['resource-url', 'media_id'],

data() {
            return {
                errors: [],
                mode: 'loading',
                selected: undefined,
                mediaFiles:[
                    {
                        'id' : '',
                        'url' : '',
                        'filename' : ''
                    }
                ]
            };
        }

 --- ETC ---

methods: {

            selectMedia() {
                let self = this;
           
                self.mediaFiles.forEach(function (value)  {
                    if(value.id === this.media_id)
                    {
                        self.selected = value.url;
                    }
                });

            }
        }

---ETC --

7th February, 2018

Vicente123 left a reply on Query Builder "addGroupBy()" Function Doesnt Works. • 2 months ago

The thing is that i wasn't renaming the columns so it never returned me the 3 values...thx

Vicente123 left a reply on Query Builder "addGroupBy()" Function Doesnt Works. • 2 months ago

@vladshoob The thing is that i want to get 3 columns at my collection, and that returns only 2. I dont even know if it's posible xD

Vicente123 started a new conversation Query Builder "addGroupBy()" Function Doesnt Works. • 2 months ago

Hi, I'm trying to use 2 groupBy in a query, found this "addGrpupBy" in the QueryBuilder.php file, so i thought it might work, but it doesn't. Here is the query.

$sessions = Session::select(array('sessions.display_name', 'sites.name', 'programs.name')) ->join('programs', 'programs.session_id', '=', 'sessions.id') ->join('sites', 'programs.site_id', '=', 'sites.id') ->join('applications', 'applications.program_id', '=', 'programs.id') ->groupBy('sites.name') ->addGroupBy('programs.name') ->get();

The error that i get: Call to undefined method Illuminate\Database\Query\Builder::addGroupBy()

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.