Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //parent
- import List from './EntitiesList'
- import Detail from './entrepreneur/EntrepreneurDetails'
- import Contacts from './Contacts'
- export default {
- components: {
- List,
- Detail,
- Contacts
- },
- data() {
- return {
- searchValue: null,
- result: null,
- selectedEntity: null,
- contacts: null
- }
- },
- methods: {
- fetchResult() {
- let suggestUrl = '/contractors/internal-api/suggest.html'
- fetch(suggestUrl).then((response) => {
- return response.json()
- }).then((data) => {
- this.result = data;
- })
- },
- reset() {
- this.searchValue = null;
- this.selectedEntity = null;
- this.result = null;
- },
- onSelect(payload){
- this.selectedEntity = payload;
- },
- sendData() {
- if(!this.isInputValid) {
- return false;
- }
- let url = '/contractors/internal-api/add-entrepreneur.html'
- fetch(url).then((response) => {
- return response.json()
- }).then((data) => {
- window.location.href = data.url;
- })
- },
- setContacts(payload){
- this.contacts = payload;
- },
- },
- computed: {
- isInputValid() {
- return this.$validator.validateAll()
- }
- }
- }
- //child
- export default {
- inject: ['$validator'],
- components: {
- bootstrapInput,
- RequiredInput
- },
- data () {
- return {
- site: null,
- phone: null,
- email: null,
- }
- },
- methods: {
- propertyUpdated(){
- this.$emit('contacts:update', {
- site: this.site,
- phone: this.phone,
- email: this.email,
- })
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement