`, methods: { formSubmit() { this.buttonDisabled = true; db.collection("projects").add({ owner: currentUserId, name: this.project_name, description: this.project_description, companies: [ this.$root.current_company ], comments: {}, last_updated: firebase.firestore.Timestamp.fromDate(new Date()), deleted: false, }).then(() => { this.$root.companyAddSuccess(); this.resetForm(); }) }, addToProject(project) { const addToProject = project.id; const company = this.$root.current_company; const docRef = db.collection("projects").doc(addToProject) db.runTransaction((t) => { return t.get(docRef).then((doc) => { if (!doc.exists) return; const newCompanies = doc.get('companies'); newCompanies.push(company); t.set(docRef, { companies: newCompanies, last_updated: firebase.firestore.Timestamp.fromDate(new Date()), }, { merge: true }); }); }).then(() => { this.$root.companyAddSuccess(); console.log("Transaction successfully committed!"); }).catch(function (error) { console.log("Transaction failed: ", error); }); }, resetForm() { this.buttonDisabled = false; this.project_name = ''; this.project_description = ''; }, } }); vueApp.component('existing-projects', { data() { return { project_id: null, } }, props: ['projects', 'disabled_projects', 'company'], template: `