Uzenkov

Experience

480

0 Best Reply Awards

  • Member Since 3 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

21st November, 2017

Uzenkov started a new conversation Database Structure • 20 hours ago

Hello everyone! If someone came across a similar problem, tell me, please, how to resolve it. There is a table of clients. There is a form through the client is created. In the form you can choose a person or a entity. They are distinguished by additional fields (there is a passport information in person and requisites in entity). In other words: they have the same fields and the different fields.

How do you usually implement such tasks? All fields in one table and use them as needed, or is there some more correct way (maybe several tables)?

My table structure

Schema::create('clients', function (Blueprint $table) {
  $table->increments('id');

  $table->unsignedInteger('company_id');
  $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');

  $table->unsignedInteger('user_id');
  $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

  $table->enum('type', ['person', 'company'])->nullable()->default(null);
  $table->boolean('lead')->nullable()->default(null);
  $table->string('lastname')->nullable()->default(null);
  $table->string('name');
  $table->string('middlename')->nullable()->default(null);
  $table->string('phone_primary');
  $table->string('phone_secondary');
  $table->string('email')->nullable()->default(null);
  $table->string('social_url')->nullable()->default(null);
  $table->date('birthday')->nullable()->default(null);
  $table->enum('gender', ['male', 'female'])->nullable()->default(null);
  $table->json('tags')->nullable()->default(null);
  $table->text('description')->nullable()->default(null);
  $table->string('source')->nullable()->default(null);

  $table->string('pass_number')->nullable()->default(null);
  $table->string('pass_lastname')->nullable()->default(null);
  $table->string('pass_name')->nullable()->default(null);
  $table->string('pass_issue')->nullable()->default(null);
  $table->string('pass_issue_date')->nullable()->default(null);
  $table->date('pass_until_date')->nullable()->default(null);
  $table->date('pass_issue_until')->nullable()->default(null);

  $table->string('entity_position')->nullable()->default(null);
  $table->string('entity_name');
  $table->string('entity_unp')->nullable()->default(null);
  $table->string('entity_okpo')->nullable()->default(null);
  $table->string('entity_country')->nullable()->default(null);
  $table->string('entity_region')->nullable()->default(null);
  $table->string('entity_district')->nullable()->default(null);
  $table->string('entity_postcode')->nullable()->default(null);
  $table->string('entity_city')->nullable()->default(null);
  $table->string('entity_address')->nullable()->default(null);
  $table->string('entity_iban')->nullable()->default(null);
  $table->string('entity_bic')->nullable()->default(null);
  $table->string('entity_bank')->nullable()->default(null);

  $table->timestamps();
});

17th November, 2017

Uzenkov left a reply on Changing The Value In Real Time • 4 days ago

@tykus Here is my components structure. As I understand it, the first levels is the parents :)

16th November, 2017

Uzenkov left a reply on Changing The Value In Real Time • 5 days ago

@tykus I'm sorry for the trouble and newbie question. How do I know where my parent components are in my structure, and where are the children?

14th November, 2017

Uzenkov left a reply on Passing Data To Event • 1 week ago

@tykus Thank you, it works!

Uzenkov left a reply on Changing The Value In Real Time • 1 week ago

@tykus Thank you, it works for me! Now I'll try to understand the Vuex.

Uzenkov left a reply on Changing The Value In Real Time • 1 week ago

@tykus Thank you for the answer! I'll try to describe in more detail.

Here is screencast how it looks now — reminders counter is not updated.

I use Laravel and Vue.js and my structure is:

Vue.component('show-reminders', require('./components/reminders/ShowReminders.vue'));
Vue.component('create-lead', require('./components/lead/CreateLead.vue'));

window.Event = new Vue();

const application = new Vue({
  el: '#application'
});

I tied to use events, but the problem still has not been solved.

I'll be glad to any help.

Uzenkov started a new conversation Passing Data To Event • 1 week ago

Hello guys. I have a problem with $emit and $on events. Here is my code:

app.js

...
window.Event = new Vue();

const application = new Vue({
  el: '#application'
});

ShowReminders.vue

<template>
  <el-badge :value="reminders.count" class="item">
    <span uk-icon="icon: bell"></span>
  </el-badge>
</template>

<script>

  export default {

    data() {
      return {
        reminders: {
          count: window.reminders.length
        }
      }
    },

    created() {
      Event.$on('lead-created', function(val) {
        this.reminders.count += val // returns undefined, there is a problem
      })
    }

  }

</script>

CreateLead.vue

<template>
...
<el-button type="success" @click="addLead" round>Add Lead</el-button>
</template>

<script>
  export default {

    ...

    addLead() {
        let counter = window.reminders.length + 1
        Event.$emit('lead-created', counter)
      ...
    }

    ...

  }
</script>

The question is: why I can't pass variables from data to Event.$on function?

Uzenkov left a reply on Changing The Value In Real Time • 1 week ago

@tykus But i have 2 different components, how can I pass the processed variable from CreateLead.vue to ShowReminders.vue?

Uzenkov started a new conversation Changing The Value In Real Time • 1 week ago

Hello everybody! Can someone tell me the correct solution of the problem? I need (the counter)[http://take.ms/uEGjZ] to be changed when an element is added.

I have the following...

ShowReminders.vue

<template>
  <el-badge :value="reminders.count" class="item">
    <span uk-icon="icon: bell"></span>
  </el-badge>
</template>

<script>

  export default {

    data() {
      return {
        reminders: {
          count: window.reminders.length
        }
      }
    }

  }

</script>

CreateLead.vue

<template>
...
<el-button type="success" @click="addLead" round>Add Lead</el-button>
</template>

<script>
  export default {

    ...

    getData() {
      window.reminders.length++ // it doesn't work
      ...
    }

    ...

  }
</script>

8th November, 2017

Uzenkov left a reply on CORS Problem • 1 week ago

7th November, 2017

Uzenkov left a reply on CORS Problem • 2 weeks ago

@CJJ It's a 3rd party public Viber API. When i use Chrome CORS Extension it works fine, but without extension 'Access-Control-Allow' headers are not sent...

Uzenkov left a reply on CORS Problem • 2 weeks ago

@CJJ Unfortunately, this does not work for me. The error still appears.

Uzenkov started a new conversation CORS Problem • 2 weeks ago

Hi everyone. I have this problem when i'm trying to send Viber message through VueJS. Could you tell me please how can I fix this?

1st November, 2017

Uzenkov started a new conversation Page Loading • 2 weeks ago

Hello guys! Who knows how to make a real page preloader without using vue-router? My solution of the problem is using v-cloak like this:

[v-cloak] > * { display:none; }
[v-cloak]::before { content: "Loading..."; }

But I don't like this solution. I like something like vue-top-progress, but don't know how implement it in my project.

My temporary incorrect solution is:

mounted() {
  this.$refs.topProgress.start();
  setTimeout(() => {
    this.$refs.topProgress.done()
  }, 500)
}

Thank you for any help!

28th October, 2017

Uzenkov left a reply on Avoid Mutating A Prop Directly Since The Value Will Be Overwritten Whenever The Parent Component Re-renders • 3 weeks ago

Problem solved.

I replaced it...

items: [{
  name: '',
  brand: '',
  status: ''
}],

...with this one.

items: [],

Thank you guys for the answers.

Uzenkov left a reply on Avoid Mutating A Prop Directly Since The Value Will Be Overwritten Whenever The Parent Component Re-renders • 3 weeks ago

@goatshark Thank you for the answer. It makes sense, but even if I pass the property directly to the template, the error does not disappear.

<el-select v-model="this.itemstatus" @change="setStatus"  placeholder="Check status">
  <el-option label="Sale" value="sale"></el-option>
  <el-option label="Ordered" value="ordered"></el-option>
  <el-option label="Paid" value="paid"></el-option>
</el-select>

27th October, 2017

Uzenkov left a reply on Avoid Mutating A Prop Directly Since The Value Will Be Overwritten Whenever The Parent Component Re-renders • 3 weeks ago

I solved the problem, moving everything into one component. But if someone answers my question, I will be grateful.

Uzenkov started a new conversation Avoid Mutating A Prop Directly Since The Value Will Be Overwritten Whenever The Parent Component Re-renders • 3 weeks ago

Hello guys. Tell me, please, what I'am doing wrong.

Items.vue

<el-table :data="items" border style="width: 100%"> <el-table-column prop="name" label="Name"> </el-table-column> <el-table-column prop="brand" label="Brand"> </el-table-column> <el-table-column prop="status" label="Status" sortable> <status-select :itemid="scope.row.id" :itemstatus="scope.row.status"> </status-select> </el-table-column> </el-table>

import Table from 'element-ui/lib/table'; import TableColumn from 'element-ui/lib/table-column';

export default {

components: { 'el-table': Table, 'el-table-column': TableColumn },

data() {
  return {
    items: [{
      name: '',
      brand: '',
      status: ''
    }]
  }
},

methods: {

  getItems() {
    axios.get('/api/items')
    .then(response => {
      this.items = response.data.items;
    })
    .catch(error => {
      console.log(error.response.data);
    });
  }

},

mounted() {
  this.getItems();
}

}

StatusSelect.vue

<el-select v-model="status" @change="setStatus" placeholder="Check status"> <el-option label="Sale" value="sale"></el-option> <el-option label="Ordered" value="ordered"></el-option> <el-option label="Paid" value="paid"></el-option> </el-select>

import Select from 'element-ui/lib/select'; import Option from 'element-ui/lib/option';

export default {

props: ['itemid', 'itemstatus'],

components: { 'el-select': Select, 'el-option': Option },

data() { return {

}

},

computed: { status: { get() { return this.itemstatus }, set(value) { this.itemstatus = value; } } },

methods: {

setStatus() {
  axios.patch('/api/items/'+this.itemid+'/status', { 'status': this.itemstatus })
  .then(response => {
    swal({
      buttons: false,
      text: response.data.message,
      icon: 'success',
      timer: 1000
    });
  })
  .catch(error => {
    console.log(error.response.data);
  });
}

},

created() { this.status = this.itemstatus; }

}

I get this error: [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "itemstatus".

Edit Your Profile
Update

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