Advertisement
Guest User

Untitled

a guest
Nov 9th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. //parent
  4.  
  5. import List from './EntitiesList'
  6. import Detail from './entrepreneur/EntrepreneurDetails'
  7. import Contacts from './Contacts'
  8.  
  9. export default {
  10.     components: {
  11.         List,
  12.         Detail,
  13.         Contacts
  14.     },
  15.     data() {
  16.         return {
  17.             searchValue: null,
  18.             result: null,
  19.             selectedEntity: null,
  20.             contacts: null
  21.         }
  22.     },
  23.     methods: {
  24.         fetchResult() {
  25.  
  26.             let suggestUrl = '/contractors/internal-api/suggest.html'
  27.  
  28.             fetch(suggestUrl).then((response) => {
  29.                 return response.json()
  30.             }).then((data) => {
  31.                 this.result = data;
  32.             })
  33.         },
  34.  
  35.         reset() {
  36.             this.searchValue = null;
  37.             this.selectedEntity = null;
  38.             this.result = null;
  39.         },
  40.  
  41.         onSelect(payload){
  42.             this.selectedEntity = payload;
  43.         },
  44.         sendData() {
  45.             if(!this.isInputValid) {
  46.                 return false;
  47.             }
  48.  
  49.             let url = '/contractors/internal-api/add-entrepreneur.html'
  50.  
  51.             fetch(url).then((response) => {
  52.                 return response.json()
  53.             }).then((data) => {
  54.                 window.location.href = data.url;
  55.             })
  56.         },
  57.         setContacts(payload){
  58.             this.contacts = payload;
  59.         },
  60.     },
  61.     computed: {
  62.         isInputValid() {
  63.             return this.$validator.validateAll()
  64.         }
  65.     }
  66. }
  67.  
  68. //child
  69.  
  70. export default {
  71.     inject: ['$validator'],
  72.     components: {
  73.         bootstrapInput,
  74.         RequiredInput
  75.     },
  76.     data () {
  77.         return {
  78.             site: null,
  79.             phone: null,
  80.             email: null,
  81.         }
  82.     },
  83.     methods: {
  84.         propertyUpdated(){
  85.             this.$emit('contacts:update', {
  86.                 site: this.site,
  87.                 phone: this.phone,
  88.                 email: this.email,
  89.             })
  90.         }
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement