From 0f877e866e5c046b0e0966fd339504ce6143c1e9 Mon Sep 17 00:00:00 2001 From: digvijay26 Date: Wed, 13 Jan 2021 22:10:48 +0530 Subject: [PATCH] issues fixation --- src/components/Profile.vue | 50 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/components/Profile.vue b/src/components/Profile.vue index aa4ca85..f3ed09a 100644 --- a/src/components/Profile.vue +++ b/src/components/Profile.vue @@ -435,6 +435,7 @@ value="" placeholder=" " v-model="cum.comment" + v-on:blur="updateComment(cum)" /> @@ -500,6 +501,7 @@ export default { data() { return { + object:null, loggedinFlag: false, templateImage:null, caseId: null, @@ -596,12 +598,27 @@ export default { async slideSelected(i) { console.log("id is", this.templateList[i]); - var slideMetadata = {}; - var obj = Object.assign( this.templateList[i],{}); + this.object = JSON.parse(JSON.stringify(this.templateList[i])); + + // var keys = Object.keys(this.templateList[i]); + // keys.forEach(element => { + // obj[element] = this.templateList[i][element]; + // }); + + console.log("obj", this.object) // slideMetadata = await this.getMeatda(this.templateList[i]._id); this.slideId = null; // this.templateList[i].metaData = slideMetadata.metaData; - this.caseStudy.slides.push(obj); + this.caseStudy.slides.push( this.object); + this.templateList[i].metaData.fields.forEach(fields_ => { + fields_.fieldValue == null + }); + if(this.templateList[i].metaData.comments){ + this.templateList[i].metaData.comments.forEach(coments_ => { + coments_.comment == null + }); + + } console.log("this.caseStudy.slides", this.caseStudy.slides); }, async insightSelected(data) { @@ -789,6 +806,7 @@ export default { .then((response) => { var finalArray = []; response.data.data.forEach((template_) => { + console.log("template_",template_) var keys = []; var i = this.templateList.findIndex( (temp_) => temp_._id == template_.templateId @@ -806,6 +824,7 @@ export default { }; if (this.templateList[i].bounceBoard) { obj.commentBox = this.templateList[i].commentBox; + obj.metaData.comments = template_.comments; } if (this.templateList[i].insight) { obj.insightId = template_.insightId; @@ -873,6 +892,30 @@ export default { this.saveProfile(slidArray); } }, + updateComment(cmnt){ + if(!cmnt._id){ + return; + } + console.log("cmnts",cmnt); + var obj = { + 'slideId':cmnt.slideId, + 'commentId':cmnt._id, + 'comment':cmnt.comment + }; + axios + .put("/superAdmin/comment", obj, { + headers: { + Authorization: "Bearer " + this.usertoken, + }, + }) + .then((response) => { + + console.log(response); + }) + .catch((error) => { + + }); + }, saveProfile(slides) { var obj = {}; @@ -900,6 +943,7 @@ export default { } }); }, + updateProfile(slides) { var obj = {}; obj.caseStudyId = this.caseId, -- 2.0.0