Commit 0e3c6b828304cce2fdb795242d20985e04813bcc

Authored by Neeraj Sharma
1 parent 37f413ce84
Exists in admin

add create study fields

Showing 1 changed file with 168 additions and 114 deletions   Show diff stats
src/components/Profile.vue
1 <template> 1 <template>
2 <main class="landing-page"> 2 <main class="landing-page">
3 3 <!-- profile -->
4
5 <!-- profile -->
6 <div class="popup-wrp" style="display: none"> 4 <div class="popup-wrp" style="display: none">
7 <div class="overlay" @click="hideDialog"></div> 5 <div class="overlay" @click="hideDialog"></div>
8 <div class="popup-set" id="add-profile" style="display: none;width:700px"> 6 <div
9 7 class="popup-set"
8 id="add-profile"
9 style="display: none; width: 700px"
10 >
10 <!-- header --> 11 <!-- header -->
11 <div class="popup-body"> 12 <div class="popup-body">
12 <form class="popup-forms"> 13 <form class="popup-forms">
13 <div class="row"> 14 <div class="row">
14 <!-- input --> 15 <!-- input -->
15 <img :src="templateImage" /> 16 <img :src="templateImage" />
16 <!-- input --> 17 <!-- input -->
17 18
18
19
20 <!-- input --> 19 <!-- input -->
21 20
22 <!-- input --> 21 <!-- input -->
23 <!-- <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 22 <!-- <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
24 <div class="form-group floating-label"> 23 <div class="form-group floating-label">
25 <select class="form-group"> 24 <select class="form-group">
26 <option @click="addSocialLink">Add another</option> 25 <option @click="addSocialLink">Add another</option>
27 </select> 26 </select>
28 <span class="select-arrow" 27 <span class="select-arrow"
29 ><img src="../assets/images/chevron-down.svg" 28 ><img src="../assets/images/chevron-down.svg"
30 /></span> 29 /></span>
31 </div> 30 </div>
32 </div> --> 31 </div> -->
33 <!-- input --> 32 <!-- input -->
34 </div> 33 </div>
35
36 </form> 34 </form>
37 </div> 35 </div>
38 <div class="clearfix"></div> 36 <div class="clearfix"></div>
39 </div> 37 </div>
40 <!-- add profile --> 38 <!-- add profile -->
41 </div> 39 </div>
42 <!-- profile --> 40 <!-- profile -->
43 <!-- profile --> 41 <!-- profile -->
44 <div class="container-fluid inner-wrp" style="background: transparent"> 42 <div class="container-fluid inner-wrp" style="background: transparent">
45 <nav class="navbar navbar-expand-sm spotLight-nav"> 43 <nav class="navbar navbar-expand-sm spotLight-nav">
46 <a class="navbar-brand" href="#" 44 <a class="navbar-brand" href="#"
47 ><img src="../assets/images/logo.png" 45 ><img src="../assets/images/logo.png"
48 /></a> 46 /></a>
49 <button 47 <button
50 class="navbar-toggler" 48 class="navbar-toggler"
51 type="button" 49 type="button"
52 data-toggle="collapse" 50 data-toggle="collapse"
53 data-target="#navbarsExample03" 51 data-target="#navbarsExample03"
54 aria-controls="navbarsExample03" 52 aria-controls="navbarsExample03"
55 aria-expanded="false" 53 aria-expanded="false"
56 aria-label="Toggle navigation" 54 aria-label="Toggle navigation"
57 > 55 >
58 <span class="navbar-toggler-icon"></span> 56 <span class="navbar-toggler-icon"></span>
59 <span class="navbar-toggler-icon"></span> 57 <span class="navbar-toggler-icon"></span>
60 <span class="navbar-toggler-icon"></span> 58 <span class="navbar-toggler-icon"></span>
61 </button> 59 </button>
62 60
63 <div class="collapse navbar-collapse" id="navbarsExample03"> 61 <div class="collapse navbar-collapse" id="navbarsExample03">
64 <ul class="navbar-nav mr-auto"> 62 <ul class="navbar-nav mr-auto">
65 <li class="nav-item active"> 63 <li class="nav-item active">
66 <a class="nav-link" style="cursor:pointer" @click="listPage('/casestudy')">Case Study List</a> 64 <a
65 class="nav-link"
66 style="cursor: pointer"
67 @click="listPage('/casestudy')"
68 >Case Study List</a
69 >
67 </li> 70 </li>
68 <li class="nav-item active"> 71 <li class="nav-item active">
69 <a class="nav-link" style="cursor:pointer" @click="listPage('/insight')">Create Insight</a> 72 <a
73 class="nav-link"
74 style="cursor: pointer"
75 @click="listPage('/insight')"
76 >Create Insight</a
77 >
70 </li> 78 </li>
71 </ul> 79 </ul>
72 </div> 80 </div>
73 <div class=""> 81 <div class="">
74 <a href="javascript:void(0);" @click="logout">Log Out </a> 82 <a href="javascript:void(0);" @click="logout">Log Out </a>
75 </div> 83 </div>
76 </nav> 84 </nav>
77 <!-- menu wrapper --> 85 <!-- menu wrapper -->
78 <div class="row profile-tab-spc-top"> 86 <div class="row profile-tab-spc-top">
79 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 87 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
80 <div class="user-profile"> 88 <div class="user-profile">
81 <div class="form-group floating-label"> 89 <div class="form-group floating-label">
82 <select 90 <select
83 class="form-control" 91 class="form-control"
84 v-model="userData" 92 v-model="userData"
85 v-on:change="selectUser(userData)" 93 v-on:change="selectUser(userData)"
86 :disabled="editMode" 94 :disabled="editMode"
87 > 95 >
88 <option value="null">Select User</option> 96 <option value="null">Select User</option>
89 <option v-for="(user, i) in userList" :key="i" :value="i"> 97 <option v-for="(user, i) in userList" :key="i" :value="i">
90 {{ user.name }} ({{ user.email }}) 98 {{ user.name }} ({{ user.email }})
91 </option> 99 </option>
92 </select> 100 </select>
93 </div> 101 </div>
94 </div> 102 </div>
95 </div> 103 </div>
96 </div> 104 </div>
97 105
98 <div class="row"> 106 <div class="row">
99 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 107 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
100 <ul class="navbar-nav mr-auto"> 108 <ul class="navbar-nav mr-auto">
101 <li class="nav-item active"> 109 <li class="nav-item active">
102 <h5 class="nav-link">Intro Screen Record</h5> 110 <h5 class="nav-link">Intro Screen Record</h5>
103 </li> 111 </li>
104 </ul> 112 </ul>
105 </div> 113 </div>
106 </div> 114 </div>
107 <!-- 1st row --> 115 <!-- 1st row -->
108 <div class="row"> 116 <div class="row">
109 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 117 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
110 <div class="form-group floating-label"> 118 <div class="form-group floating-label">
111 <label for="lname" class="lname">Case Study Name</label> 119 <label for="lname" class="lname">Case Study Name</label>
112 <input 120 <input
113 type="text" 121 type="text"
114 class="form-control" 122 class="form-control"
115 value="" 123 value=""
116 placeholder=" " 124 placeholder=" "
117 v-model="caseStudy.caseStudyDetails.intro.name" 125 v-model="caseStudy.caseStudyDetails.intro.name"
118 /> 126 />
119 </div> 127 </div>
120 </div> 128 </div>
121 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 129 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
122 <div class="form-group floating-label"> 130 <div class="form-group floating-label">
123 <label for="lname" class="lname">App Name</label> 131 <label for="lname" class="lname">App Name</label>
124 <input 132 <input
125 type="text" 133 type="text"
126 class="form-control" 134 class="form-control"
127 value="" 135 value=""
128 placeholder=" " 136 placeholder=" "
129 v-model="caseStudy.caseStudyDetails.intro.app" 137 v-model="caseStudy.caseStudyDetails.intro.app"
130 /> 138 />
131 </div> 139 </div>
132 </div> 140 </div>
133 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 141 <!-- <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
134 <!-- <div class="form-group floating-label"> 142 <div class="form-group floating-label">
135 <label for="lname" class="lname">Focus</label> 143 <label for="lname" class="lname">Focus</label>
136 <input 144 <input
137 type="text" 145 type="text"
138 class="form-control" 146 class="form-control"
139 value="" 147 value=""
140 placeholder=" " 148 placeholder=" "
141 v-model="caseStudy.caseStudyDetails.intro.focus" 149 v-model="caseStudy.caseStudyDetails.intro.focus"
142 /> 150 />
143 </div> --> 151 </div>
152 </div> -->
153
154 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
155 <div class="form-group floating-label">
156 <label for="lname" class="lname"> App logo</label>
157 <img
158 v-if="caseStudy.caseStudyDetails.intro.logoURL"
159 style="width: 40px; height: 40px"
160 :src="caseStudy.caseStudyDetails.intro.logoURL"
161 />
162 <input
163 @change="createImage('logo')"
164 type="file"
165 name="photso"
166 id="logo"
167 accept="image/*"
168 />
169 </div>
144 </div> 170 </div>
145 </div> 171 </div>
146 <!-- 1st row end --> 172 <!-- 1st row end -->
147 173
148 <!-- 2nd row --> 174 <!-- 2nd row -->
149 <div class="row"> 175 <div class="row">
150 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 176 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
151 <div class="form-group floating-label"> 177 <div class="form-group floating-label">
152 <label for="lname" class="lname">Case Study Type</label> 178 <label for="lname" class="lname">Case Study Type</label>
153 <select 179 <select
154 class="form-control" 180 class="form-control"
155 v-model="caseStudy.caseStudyDetails.intro.type" 181 v-model="caseStudy.caseStudyDetails.intro.type"
156 > 182 >
157 <option value="null">Select Case Type</option> 183 <option value="null">Select Case Type</option>
158 <option value="Retake">Retake</option> 184 <option value="Retake">Retake</option>
159 <option value="Behind-the-scenes">Behind-the-scenes</option> 185 <option value="Behind-the-scenes">Behind-the-scenes</option>
160 <option value="Critique">Critique</option> 186 <option value="Critique">Critique</option>
161 <option value="Juxtapose">Juxtapose</option> 187 <option value="Juxtapose">Juxtapose</option>
162 </select> 188 </select>
163 </div> 189 </div>
164 </div> 190 </div>
165 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 191 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
166 <div class="form-group floating-label"> 192 <div class="form-group floating-label">
167 <label for="lname" class="lname">Platform</label> 193 <label for="lname" class="lname">Platform</label>
168 <input 194 <!-- <input
169 type="text" 195 type="text"
170 class="form-control" 196 class="form-control"
171 value="" 197 value=""
172 placeholder=" " 198 placeholder=" "
173 v-model="caseStudy.caseStudyDetails.intro.platForm" 199 v-model="caseStudy.caseStudyDetails.intro.platForm"
174 /> 200 /> -->
201 <select
202 class="form-control"
203 v-model="selectPlatform"
204 @change="addInsight('platform')"
205 >
206 <option value="null">Select Insight Tag</option>
207 <option value="Ios">Ios</option>
208 <option value="Web">Web</option>
209 <option value="Android">Android</option>
210 </select>
175 </div> 211 </div>
176 </div> 212 </div>
177
178 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 213 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
179 <div class="form-group floating-label"> 214 <div class="form-group floating-label">
180 <label for="lname" class="lname"> App logo</label> 215 <label for="lname" class="lname"></label>
181 <img v-if="caseStudy.caseStudyDetails.intro.logoURL" style="width:40px;height: 40px;" :src="caseStudy.caseStudyDetails.intro.logoURL" 216 <label for="lname" class="lname"></label>
182 /> 217 <ul class="interests">
183 <input 218 <!-- v-for="(interest, i) in caseStudy.caseStudyDetails
184 @change="createImage('logo')" 219 .insightTags"
185 type="file" 220 :key="i" -->
186 name="photso" 221
187 id="logo" 222 <li v-if="caseStudy.caseStudyDetails.intro.platForm">
188 accept="image/*" 223 <span>{{ caseStudy.caseStudyDetails.intro.platForm }}</span>
189 /> 224 <a
225 href="javascript:void(0);"
226 @click="removeInsight(0, 'platform')"
227 class="cat-minus"
228 ><img src="../assets/images/minus.svg"
229 /></a>
230 </li>
231 </ul>
190 </div> 232 </div>
191 </div> 233 </div>
192 </div> 234 </div>
193 <!-- 2nd row --> 235 <!-- 2nd row -->
194 <!-- 3rd row --> 236 <!-- 3rd row -->`
195 <div class="row"> 237 <div class="row">
196 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 238 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
197 <div class="form-group floating-label"> 239 <div class="form-group floating-label">
198 <label for="lname" class="lname"></label> 240 <label for="lname" class="lname"></label>
199 <ul class="interests"> 241 <ul class="interests">
200 <li> 242 <li>
201 <input 243 <input
202 class="" 244 class=""
203 placeholder="Add Focus Areas" 245 placeholder="Add Focus Areas"
204 v-model="focusName" 246 v-model="focusName"
205 v-on:keyup.enter="addInsight('focus')" 247 v-on:keyup.enter="addInsight('focus')"
206
207 /> 248 />
208 <a href="javascript:void(0);" @click="addInsight('focus')" 249 <a href="javascript:void(0);" @click="addInsight('focus')"
209 ><img src="../assets/images/plus-circle.svg" 250 ><img src="../assets/images/plus-circle.svg"
210 /></a> 251 /></a>
211 </li> 252 </li>
212 253
213 <li 254 <li
214 v-for="(interest, i) in caseStudy.caseStudyDetails.focusAreas" 255 v-for="(interest, i) in caseStudy.caseStudyDetails.focusAreas"
215 :key="i" 256 :key="i"
216 > 257 >
217 <span>{{ interest }}</span> 258 <span>{{ interest }}</span>
218 <a 259 <a
219 href="javascript:void(0);" 260 href="javascript:void(0);"
220 @click="removeInsight(i, 'focus')" 261 @click="removeInsight(i, 'focus')"
221 class="cat-minus" 262 class="cat-minus"
222 ><img src="../assets/images/minus.svg" 263 ><img src="../assets/images/minus.svg"
223 /></a> 264 /></a>
224 </li> 265 </li>
225 </ul> 266 </ul>
226 </div> 267 </div>
227 </div> 268 </div>
228 269
229 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 270 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
230 <div class="form-group floating-label"> 271 <div class="form-group floating-label">
231 <label for="lname" class="lname">Select Insight Tags</label> 272 <label for="lname" class="lname">Select Insight Tags</label>
232 <select 273 <select
233 class="form-control" 274 class="form-control"
234 v-model="insightName" 275 v-model="insightName"
235 @change="addInsight('insight')" 276 @change="addInsight('insight')"
236 > 277 >
237 <option value="null">Select Insight Tag</option> 278 <option value="null">Select Insight Tag</option>
238 <option value="Design">Design</option> 279 <option value="Design">Design</option>
239 <option value="Product">Product</option> 280 <option value="Product">Product</option>
240 <option value="Marketing">Marketing</option> 281 <option value="Marketing">Marketing</option>
241 <option value="Pricing">Pricing</option> 282 <option value="Pricing">Pricing</option>
242 <option value="Psychology">Psychology</option> 283 <option value="Psychology">Psychology</option>
243 </select> 284 </select>
244 </div> 285 </div>
245 </div> 286 </div>
246 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 287 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
247 <div class="form-group floating-label"> 288 <div class="form-group floating-label">
248 <label for="lname" class="lname"></label> 289 <label for="lname" class="lname"></label>
249 <ul class="interests"> 290 <ul class="interests">
250 <li 291 <li
251 v-for="(interest, i) in caseStudy.caseStudyDetails.insightTags" 292 v-for="(interest, i) in caseStudy.caseStudyDetails.insightTags"
252 :key="i" 293 :key="i"
253 > 294 >
254 <span>{{ interest }}</span> 295 <span>{{ interest }}</span>
255 <a 296 <a
256 href="javascript:void(0);" 297 href="javascript:void(0);"
257 @click="removeInsight(i, 'insight')" 298 @click="removeInsight(i, 'insight')"
258 class="cat-minus" 299 class="cat-minus"
259 ><img src="../assets/images/minus.svg" 300 ><img src="../assets/images/minus.svg"
260 /></a> 301 /></a>
261 </li> 302 </li>
262 </ul> 303 </ul>
263 </div> 304 </div>
264 </div> 305 </div>
265 </div> 306 </div>
266 <!-- 3rd row end --> 307 <!-- 3rd row end -->
267 308
268 <!-- outdor --> 309 <!-- outdor -->
269 <div class="row profile-tab-spc-top"> 310 <div class="row profile-tab-spc-top">
270 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 311 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
271 <ul class="navbar-nav mr-auto"> 312 <ul class="navbar-nav mr-auto">
272 <li class="nav-item active"> 313 <li class="nav-item active">
273 <h5 class="nav-link">Outro Screen Record</h5> 314 <h5 class="nav-link">Outro Screen Record</h5>
274 </li> 315 </li>
275 </ul> 316 </ul>
276 </div> 317 </div>
277 </div> 318 </div>
278 319
279 <!-- 1st row --> 320 <!-- 1st row -->
280 <div class="row"> 321 <div class="row">
281 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 322 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
282 <div class="form-group floating-label"> 323 <div class="form-group floating-label">
283 <label for="lname" class="lname">Designer Name</label> 324 <label for="lname" class="lname">Designer Name</label>
284 <input 325 <input
285 type="text" 326 type="text"
286 class="form-control" 327 class="form-control"
287 value="" 328 value=""
288 placeholder=" " 329 placeholder=" "
289 v-model="caseStudy.caseStudyDetails.outro.designer" 330 v-model="caseStudy.caseStudyDetails.outro.designer"
290 /> 331 />
291 </div> 332 </div>
292 </div> 333 </div>
293 334
294 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 335 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
295 <div class="form-group floating-label"> 336 <div class="form-group floating-label">
296 <label for="lname" class="lname">Illustrations Name</label> 337 <label for="lname" class="lname">Illustrations Name</label>
297 <input 338 <input
298 type="text" 339 type="text"
299 class="form-control" 340 class="form-control"
300 value="" 341 value=""
301 placeholder=" " 342 placeholder=" "
302 v-model="caseStudy.caseStudyDetails.outro.illustrations" 343 v-model="caseStudy.caseStudyDetails.outro.illustrations"
303 /> 344 />
304 </div> 345 </div>
305 </div> 346 </div>
306 347
307 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 348 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
308 <div class="form-group floating-label"> 349 <div class="form-group floating-label">
309 <label for="lname" class="lname"> Author Image</label> 350 <label for="lname" class="lname"> Author Image</label>
310 <img v-if="caseStudy.caseStudyDetails.outro.authorImage[0]" style="width:40px;height: 40px;" :src="caseStudy.caseStudyDetails.outro.authorImage[0]" 351 <img
311 /> 352 v-if="caseStudy.caseStudyDetails.outro.authorImage[0]"
353 style="width: 40px; height: 40px"
354 :src="caseStudy.caseStudyDetails.outro.authorImage[0]"
355 />
312 <input 356 <input
313 @change="createImage('outdor')" 357 @change="createImage('outdor')"
314 type="file" 358 type="file"
315 name="photos" 359 name="photos"
316 id="outdor" 360 id="outdor"
317 accept="image/*" 361 accept="image/*"
318 /> 362 />
319 </div> 363 </div>
320 </div> 364 </div>
321 </div> 365 </div>
322 <!-- 1st row --> 366 <!-- 1st row -->
323 <!-- outdoor ends --> 367 <!-- outdoor ends -->
324 368
325 <!-- outdor --> 369 <!-- outdor -->
326 <div class="row profile-tab-spc-top"> 370 <div class="row profile-tab-spc-top">
327 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 371 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
328 <ul class="navbar-nav mr-auto"> 372 <ul class="navbar-nav mr-auto">
329 <li class="nav-item active"> 373 <li class="nav-item active">
330 <h5 class="nav-link">Add SLides</h5> 374 <h5 class="nav-link">Add SLides</h5>
331 </li> 375 </li>
332 </ul> 376 </ul>
333 </div> 377 </div>
334 </div> 378 </div>
335 379
336
337
338 <!-- case study slides--> 380 <!-- case study slides-->
339 <div 381 <div
340 class="row profile-tab-spc-top" 382 class="row profile-tab-spc-top"
341 v-for="(slide, i) in caseStudy.slides" 383 v-for="(slide, i) in caseStudy.slides"
342 :key="i" 384 :key="i"
343 > 385 >
344 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 386 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
345 <ul class="navbar-nav mr-auto"> 387 <ul class="navbar-nav mr-auto">
346 <li class="nav-item active"> 388 <li class="nav-item active">
347 <p class="nav-link"> 389 <p class="nav-link">
348 <b>Screen {{ i + 1 }}</b> 390 <b>Screen {{ i + 1 }}</b>
349 <a 391 <a
350 style="cursor: pointer; color: red; font-size: 0.8rem" 392 style="cursor: pointer; color: red; font-size: 0.8rem"
351 @click="removeSlide(i)" 393 @click="removeSlide(i)"
352 > 394 >
353 Remove</a 395 Remove</a
354 > 396 >
355 <a 397 <a
356 style="cursor: pointer; color: blue; font-size: 0.8rem" 398 style="cursor: pointer; color: blue; font-size: 0.8rem"
357 @click="addProfileDialog(slide)" 399 @click="addProfileDialog(slide)"
358 > 400 >
359 View</a 401 View</a
360 > 402 >
361 </p> 403 </p>
362 </li> 404 </li>
363 <li class="nav-item active" v-if="slide.insight"> 405 <li class="nav-item active" v-if="slide.insight">
364 <div class="form-group floating-label"> 406 <div class="form-group floating-label">
365 <label for="lname" class="lname">Insight</label> 407 <label for="lname" class="lname">Insight</label>
366 <select 408 <select
367 class="form-control" 409 class="form-control"
368 v-model="insightId" 410 v-model="insightId"
369 v-on:change="insightSelected(slide)" 411 v-on:change="insightSelected(slide)"
370 > 412 >
371 <option value="null">Select Insight</option> 413 <option value="null">Select Insight</option>
372 <option v-for="(insight, i) in insightList" :key="i" :value="insight._id"> 414 <option
373 {{ insight.title }} 415 v-for="(insight, i) in insightList"
374 </option> 416 :key="i"
375 </select> 417 :value="insight._id"
376 </div> 418 >
419 {{ insight.title }}
420 </option>
421 </select>
422 </div>
377 </li> 423 </li>
378 </ul> 424 </ul>
379 </div> 425 </div>
380
381
382
383
384
385 426
386 <div class="row"> 427 <div class="row">
387 <div 428 <div
388 class="col-sm-4 col-md-4 col-lg-4 col-xl-4" 429 class="col-sm-4 col-md-4 col-lg-4 col-xl-4"
389 v-for="(field, j) in slide.metaData.fields" 430 v-for="(field, j) in slide.metaData.fields"
390 :key="j" 431 :key="j"
391 > 432 >
392 <div 433 <div
393 class="form-group floating-label" 434 class="form-group floating-label"
394 v-if="field.fieldType == 'text'" 435 v-if="field.fieldType == 'text'"
395 > 436 >
396 <label for="lname" class="lname">{{ field.displayName }}</label> 437 <label for="lname" class="lname">{{ field.displayName }}</label>
397 <input 438 <input
398 type="text" 439 type="text"
399 class="form-control" 440 class="form-control"
400 value="" 441 value=""
401 placeholder=" " 442 placeholder=" "
402 v-model="field.fieldValue" 443 v-model="field.fieldValue"
403 /> 444 />
404 </div> 445 </div>
405 446
406 <div 447 <div
407 class="form-group floating-label" 448 class="form-group floating-label"
408 v-if="field.fieldType == 'image'" 449 v-if="field.fieldType == 'image'"
409 > 450 >
410 <label for="lname" class="lname"> {{ field.displayName }}</label> 451 <label for="lname" class="lname"> {{ field.displayName }}</label>
411 <img v-if="field.fieldValue" style="width:40px;height: 40px;" :src="field.fieldValue" 452 <img
412 /> 453 v-if="field.fieldValue"
454 style="width: 40px; height: 40px"
455 :src="field.fieldValue"
456 />
413 <input 457 <input
414 @change="fieldcreateImage(i, j)" 458 @change="fieldcreateImage(i, j)"
415 type="file" 459 type="file"
416 name="photo" 460 name="photo"
417 :id="i + '' + j" 461 :id="i + '' + j"
418 accept="image/*" 462 accept="image/*"
419 /> 463 />
420 </div> 464 </div>
421 </div> 465 </div>
422 </div> 466 </div>
423 467
424 <div class="row"> 468 <div class="row">
425 <div 469 <div
426 class="col-sm-4 col-md-4 col-lg-4 col-xl-4" 470 class="col-sm-4 col-md-4 col-lg-4 col-xl-4"
427 v-for="(cum, j) in slide.metaData.comments" 471 v-for="(cum, j) in slide.metaData.comments"
428 :key="j" 472 :key="j"
429 > 473 >
430 <div class="form-group floating-label"> 474 <div class="form-group floating-label">
431 <label for="lname" class="lname">Comment Box {{ j + 1 }}</label> 475 <label for="lname" class="lname">Comment Box {{ j + 1 }}</label>
432 <input 476 <input
433 type="text" 477 type="text"
434 class="form-control" 478 class="form-control"
435 value="" 479 value=""
436 placeholder=" " 480 placeholder=" "
437 v-model="cum.comment" 481 v-model="cum.comment"
438 v-on:blur="updateComment(cum)" 482 v-on:blur="updateComment(cum)"
439 /> 483 />
440 </div> 484 </div>
441 </div> 485 </div>
442 </div> 486 </div>
443
444 </div> 487 </div>
445 488
446
447 <!-- 1st row --> 489 <!-- 1st row -->
448 <div class="row"> 490 <div class="row">
449 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 491 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
450 <div class="form-group floating-label"> 492 <div class="form-group floating-label">
451 <label for="lname" class="lname">Slides Name</label> 493 <label for="lname" class="lname">Slides Name</label>
452 <select 494 <select
453 class="form-control" 495 class="form-control"
454 v-model="slideId" 496 v-model="slideId"
455 v-on:change="slideSelected(slideId)" 497 v-on:change="slideSelected(slideId)"
456 > 498 >
457 <option value="null">Select Slide</option> 499 <option value="null">Select Slide</option>
458 <option v-for="(template, i) in templateList" :key="i" :value="i"> 500 <option v-for="(template, i) in templateList" :key="i" :value="i">
459 {{ template.name }} 501 {{ template.name }}
460 </option> 502 </option>
461 </select> 503 </select>
462 </div> 504 </div>
463 </div> 505 </div>
464 </div> 506 </div>
465 <!-- 1st row --> 507 <!-- 1st row -->
466 508
467 <!-- 1st row end --> 509 <!-- 1st row end -->
468 <!-- case study ends --> 510 <!-- case study ends -->
469 <div class="clearfix"></div> 511 <div class="clearfix"></div>
470 512
471 <!-- users land image --> 513 <!-- users land image -->
472 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"> 514 <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
473 <div class="form-layout signup-frm-spc"> 515 <div class="form-layout signup-frm-spc">
474 <form> 516 <form>
475 <a 517 <a
476 href="javascript:void(0);" 518 href="javascript:void(0);"
477 class="btn btn-lg sb-button" 519 class="btn btn-lg sb-button"
478 type="submit" 520 type="submit"
479 @click="submit" 521 @click="submit"
480 > 522 >
481 <img src="../assets/images/key.svg" /> submit 523 <img src="../assets/images/key.svg" /> submit
482 </a> 524 </a>
483 </form> 525 </form>
484 </div> 526 </div>
485 </div> 527 </div>
486 528
487 <!-- data wrp --> 529 <!-- data wrp -->
488 <!-- body wrapper --> 530 <!-- body wrapper -->
489 </div> 531 </div>
490 </main> 532 </main>
491 </template> 533 </template>
492 534
493 <script> 535 <script>
494 import Vue from "vue"; 536 import Vue from "vue";
495 import router from "../router"; 537 import router from "../router";
496 import $ from "jquery"; 538 import $ from "jquery";
497 import axios from "axios"; 539 import axios from "axios";
498 540
499 export default { 541 export default {
500 name: "Profile", 542 name: "Profile",
501 543
502 data() { 544 data() {
503 return { 545 return {
504 object:null, 546 object: null,
505 loggedinFlag: false, 547 loggedinFlag: false,
506 templateImage:null, 548 templateImage: null,
507 caseId: null, 549 caseId: null,
508 editMode: false, 550 editMode: false,
509 userData: null, 551 userData: null,
510 usertoken: null, 552 usertoken: null,
511 insightName: null, 553 insightName: null,
512 focusName: null, 554 focusName: null,
513 slideId: null, 555 slideId: null,
514 userList: [], 556 userList: [],
515 templateList: [], 557 templateList: [],
516 insightList: [], 558 insightList: [],
517 insightId:null, 559 insightId: null,
518 caseStudy: { 560 caseStudy: {
519 caseStudyDetails: { 561 caseStudyDetails: {
520 userId: [], 562 userId: [],
521 intro: { 563 intro: {
522 name: null, 564 name: null,
523 logoURL: null, 565 logoURL: null,
524 app: null, 566 app: null,
525 type: null, 567 type: null,
526 readTime: null, 568 readTime: null,
527 platForm: null, 569 platForm: null,
528 authors: [], 570 authors: [],
529 }, 571 },
530 outro: { 572 outro: {
531 authorImage: [], 573 authorImage: [],
532 authors: [], 574 authors: [],
533 designer: null, 575 designer: null,
534 illustrations: null, 576 illustrations: null,
535 }, 577 },
536 insightTags: [], 578 insightTags: [],
537 focusAreas: [], 579 focusAreas: [],
538 }, 580 },
539 slides: [], 581 slides: [],
540 }, 582 },
583 selectPlatform: "",
541 }; 584 };
542 }, 585 },
543 mounted() { 586 mounted() {
544 if (this.$route.fullPath.split("?").length == 2) { 587 if (this.$route.fullPath.split("?").length == 2) {
545 this.editMode = true; 588 this.editMode = true;
546 this.caseId = this.$route.fullPath.split("?")[1]; 589 this.caseId = this.$route.fullPath.split("?")[1];
547 var introData = localStorage.getItem("spotlight_caseStudy" + this.caseId); 590 var introData = localStorage.getItem("spotlight_caseStudy" + this.caseId);
548 if (introData) { 591 if (introData) {
549 introData = JSON.parse(introData); 592 introData = JSON.parse(introData);
550 console.log("introData", introData); 593 console.log("introData", introData);
551 if(introData.intro.focus){ 594 if (introData.intro.focus) {
552 delete introData.intro.focus; 595 delete introData.intro.focus;
553 } 596 }
554 this.caseStudy.caseStudyDetails.intro = introData.intro; 597 this.caseStudy.caseStudyDetails.intro = introData.intro;
555 this.caseStudy.caseStudyDetails.userId = introData.userId; 598 this.caseStudy.caseStudyDetails.userId = introData.userId;
556 this.caseStudy.caseStudyDetails.outro = introData.outro; 599 this.caseStudy.caseStudyDetails.outro = introData.outro;
557 this.caseStudy.caseStudyDetails.insightTags = introData.insightTags; 600 this.caseStudy.caseStudyDetails.insightTags = introData.insightTags;
558 this.caseStudy.caseStudyDetails.focusAreas = introData.focusAreas; 601 this.caseStudy.caseStudyDetails.focusAreas = introData.focusAreas;
602 this.selectPlatform = introData.intro.platForm;
603 console.log("this.selectPlatform", this.selectPlatform);
559 } 604 }
560 } 605 }
561 var userdata = localStorage.getItem("spotlight_usertoken"); 606 var userdata = localStorage.getItem("spotlight_usertoken");
562 if (userdata) { 607 if (userdata) {
563 userdata = JSON.parse(userdata); 608 userdata = JSON.parse(userdata);
564 this.usertoken = userdata.token; 609 this.usertoken = userdata.token;
565 this.getUserList(); 610 this.getUserList();
566 this.getTemplateList(); 611 this.getTemplateList();
567 this.getInsightList(); 612 this.getInsightList();
568 } 613 }
569 }, 614 },
570 methods: { 615 methods: {
571 selectUser(i) { 616 selectUser(i) {
572 this.userList[i]; 617 this.userList[i];
573 this.caseStudy.caseStudyDetails.intro.authors.push(this.userList[i].name); 618 this.caseStudy.caseStudyDetails.intro.authors.push(this.userList[i].name);
574 this.caseStudy.caseStudyDetails.outro.authors.push(this.userList[i].name); 619 this.caseStudy.caseStudyDetails.outro.authors.push(this.userList[i].name);
575 this.caseStudy.caseStudyDetails.userId.push(this.userList[i]._id); 620 this.caseStudy.caseStudyDetails.userId.push(this.userList[i]._id);
576 console.log("-", this.caseStudy); 621 console.log("-", this.caseStudy);
577 }, 622 },
578 623
579 logout() { 624 logout() {
580 this.$router.push("/"); 625 this.$router.push("/");
581 }, 626 },
582 addInsight(type) { 627 addInsight(type) {
583 if (type == "focus") { 628 if (type == "focus") {
584 this.caseStudy.caseStudyDetails.focusAreas.push(this.focusName); 629 this.caseStudy.caseStudyDetails.focusAreas.push(this.focusName);
585 this.focusName = null; 630 this.focusName = null;
586 } else if (type == "insight") { 631 } else if (type == "insight") {
587 this.caseStudy.caseStudyDetails.insightTags.push(this.insightName); 632 this.caseStudy.caseStudyDetails.insightTags.push(this.insightName);
588 this.insightName = null; 633 this.insightName = null;
634 } else if (type == "platform") {
635 this.caseStudy.caseStudyDetails.intro.platForm = this.selectPlatform;
636 // this.selectPlatform = null;
589 } 637 }
590 }, 638 },
591 removeInsight(i, type) { 639 removeInsight(i, type) {
592 if (type == "focus") { 640 if (type == "focus") {
593 this.caseStudy.caseStudyDetails.focusAreas.splice(i, 1); 641 this.caseStudy.caseStudyDetails.focusAreas.splice(i, 1);
594 } else if (type == "insight") { 642 } else if (type == "insight") {
595 this.caseStudy.caseStudyDetails.insightTags.splice(i, 1); 643 this.caseStudy.caseStudyDetails.insightTags.splice(i, 1);
644 } else if (type == "platform") {
645 this.caseStudy.caseStudyDetails.intro.platForm = "";
646 this.selectPlatform = null;
596 } 647 }
597 }, 648 },
598 649
599 async slideSelected(i) { 650 async slideSelected(i) {
600 console.log("id is", this.templateList[i]); 651 console.log("id is", this.templateList[i]);
601 this.object = JSON.parse(JSON.stringify(this.templateList[i])); 652 this.object = JSON.parse(JSON.stringify(this.templateList[i]));
602 653
603 // var keys = Object.keys(this.templateList[i]); 654 // var keys = Object.keys(this.templateList[i]);
604 // keys.forEach(element => { 655 // keys.forEach(element => {
605 // obj[element] = this.templateList[i][element]; 656 // obj[element] = this.templateList[i][element];
606 // }); 657 // });
607 658
608 console.log("obj", this.object) 659 console.log("obj", this.object);
609 // slideMetadata = await this.getMeatda(this.templateList[i]._id); 660 // slideMetadata = await this.getMeatda(this.templateList[i]._id);
610 this.slideId = null; 661 this.slideId = null;
611 // this.templateList[i].metaData = slideMetadata.metaData; 662 // this.templateList[i].metaData = slideMetadata.metaData;
612 this.caseStudy.slides.push( this.object); 663 this.caseStudy.slides.push(this.object);
613 this.templateList[i].metaData.fields.forEach(fields_ => { 664 this.templateList[i].metaData.fields.forEach((fields_) => {
614 fields_.fieldValue == null 665 fields_.fieldValue == null;
666 });
667 if (this.templateList[i].metaData.comments) {
668 this.templateList[i].metaData.comments.forEach((coments_) => {
669 coments_.comment == null;
615 }); 670 });
616 if(this.templateList[i].metaData.comments){ 671 }
617 this.templateList[i].metaData.comments.forEach(coments_ => {
618 coments_.comment == null
619 });
620
621 }
622 console.log("this.caseStudy.slides", this.caseStudy.slides); 672 console.log("this.caseStudy.slides", this.caseStudy.slides);
623 }, 673 },
624 async insightSelected(data) { 674 async insightSelected(data) {
625
626 // this.caseStudy.slides.push(this.templateList[i]); 675 // this.caseStudy.slides.push(this.templateList[i]);
627 676
628 console.log("data",data); 677 console.log("data", data);
629 data.insightId = this.insightId; 678 data.insightId = this.insightId;
630 // this.insightId = null; 679 // this.insightId = null;
631 }, 680 },
632 681
633 removeSlide(i) { 682 removeSlide(i) {
634 this.caseStudy.slides.splice(i, 1); 683 this.caseStudy.slides.splice(i, 1);
635 }, 684 },
636 685
637 createImage(type) { 686 createImage(type) {
638 var that = this; 687 var that = this;
639 console.log(document.getElementById(type)); 688 console.log(document.getElementById(type));
640 var file = document.getElementById(type).files[0]; 689 var file = document.getElementById(type).files[0];
641 console.log("file", file); 690 console.log("file", file);
642 var reader = new FileReader(); 691 var reader = new FileReader();
643 reader.onload = function (e) { 692 reader.onload = function (e) {
644 console.log("e.target.result ", e.target.result); 693 console.log("e.target.result ", e.target.result);
645 that.uploadImage(type, e.target.result); 694 that.uploadImage(type, e.target.result);
646 }; 695 };
647 reader.onerror = function (error) { 696 reader.onerror = function (error) {
648 alert(error); 697 alert(error);
649 }; 698 };
650 if (file) { 699 if (file) {
651 reader.readAsDataURL(file); 700 reader.readAsDataURL(file);
652 } 701 }
653 }, 702 },
654 uploadImage(type, base64) { 703 uploadImage(type, base64) {
655 console.log("type", type); 704 console.log("type", type);
656 var obj = { 705 var obj = {
657 image: base64, 706 image: base64,
658 }; 707 };
659 axios 708 axios
660 .post("/superAdmin/uploadImage", obj, { 709 .post("/superAdmin/uploadImage", obj, {
661 headers: { 710 headers: {
662 Authorization: "Bearer " + this.usertoken, 711 Authorization: "Bearer " + this.usertoken,
663 }, 712 },
664 }) 713 })
665 .then((response) => { 714 .then((response) => {
666 if (type == "logo") { 715 if (type == "logo") {
667 716 setTimeout(
668 setTimeout(() => this.caseStudy.caseStudyDetails.intro.logoURL = response.data.data, 99); 717 () =>
718 (this.caseStudy.caseStudyDetails.intro.logoURL =
719 response.data.data),
720 99
721 );
669 } else if (type == "outdor") { 722 } else if (type == "outdor") {
670 this.caseStudy.caseStudyDetails.outro.authorImage = []; 723 this.caseStudy.caseStudyDetails.outro.authorImage = [];
671 setTimeout(() => this.caseStudy.caseStudyDetails.outro.authorImage.push( 724 setTimeout(
672 response.data.data 725 () =>
673 ), 99); 726 this.caseStudy.caseStudyDetails.outro.authorImage.push(
674 727 response.data.data
728 ),
729 99
730 );
675 } 731 }
676 732
677 console.log(response.data.data); 733 console.log(response.data.data);
678 console.log(this.caseStudy); 734 console.log(this.caseStudy);
679 }) 735 })
680 .catch((error) => { 736 .catch((error) => {
681 if (error.response) { 737 if (error.response) {
682 this.$toaster.error(error.response.data.message); 738 this.$toaster.error(error.response.data.message);
683 } 739 }
684 }); 740 });
685 }, 741 },
686 742
687 fieldcreateImage(i, j) { 743 fieldcreateImage(i, j) {
688 console.log("i", i); 744 console.log("i", i);
689 console.log("j", j); 745 console.log("j", j);
690 var that = this; 746 var that = this;
691 var id = i + "" + j; 747 var id = i + "" + j;
692 console.log(document.getElementById(id)); 748 console.log(document.getElementById(id));
693 var file = document.getElementById(id).files[0]; 749 var file = document.getElementById(id).files[0];
694 // var file = document.querySelector("input[type=file]").files[0]; 750 // var file = document.querySelector("input[type=file]").files[0];
695 console.log("file", file); 751 console.log("file", file);
696 var reader = new FileReader(); 752 var reader = new FileReader();
697 reader.onload = function (e) { 753 reader.onload = function (e) {
698 // console.log("e.target.result ",e.target.result ) 754 // console.log("e.target.result ",e.target.result )
699 that.fielduploadImage(i, j, e.target.result); 755 that.fielduploadImage(i, j, e.target.result);
700 }; 756 };
701 reader.onerror = function (error) { 757 reader.onerror = function (error) {
702 alert(error); 758 alert(error);
703 }; 759 };
704 if (file) { 760 if (file) {
705 reader.readAsDataURL(file); 761 reader.readAsDataURL(file);
706 } 762 }
707 }, 763 },
708 fielduploadImage(i, j, base64) { 764 fielduploadImage(i, j, base64) {
709 var obj = { 765 var obj = {
710 image: base64, 766 image: base64,
711 }; 767 };
712 axios 768 axios
713 .post("/superAdmin/uploadImage", obj, { 769 .post("/superAdmin/uploadImage", obj, {
714 headers: { 770 headers: {
715 Authorization: "Bearer " + this.usertoken, 771 Authorization: "Bearer " + this.usertoken,
716 }, 772 },
717 }) 773 })
718 .then((response) => { 774 .then((response) => {
719 setTimeout(() => this.caseStudy.slides[i].metaData.fields[j].fieldValue = 775 setTimeout(
720 response.data.data, 10); 776 () =>
777 (this.caseStudy.slides[i].metaData.fields[j].fieldValue =
778 response.data.data),
779 10
780 );
721 781
722
723 console.log(response.data.data); 782 console.log(response.data.data);
724 console.log(this.caseStudy); 783 console.log(this.caseStudy);
725 }) 784 })
726 .catch((error) => { 785 .catch((error) => {
727 if (error.response) { 786 if (error.response) {
728 this.$toaster.error(error.response.data.message); 787 this.$toaster.error(error.response.data.message);
729 } 788 }
730 }); 789 });
731 }, 790 },
732 791
733 getUserList() { 792 getUserList() {
734 axios 793 axios
735 .get("/superAdmin/users", { 794 .get("/superAdmin/users", {
736 headers: { 795 headers: {
737 Authorization: "Bearer " + this.usertoken, 796 Authorization: "Bearer " + this.usertoken,
738 }, 797 },
739 }) 798 })
740 .then((response) => { 799 .then((response) => {
741 response.data.data.forEach((element) => { 800 response.data.data.forEach((element) => {
742 if (element.name) { 801 if (element.name) {
743 this.userList.push(element); 802 this.userList.push(element);
744 } 803 }
745 }); 804 });
746 console.log("response", this.userList); 805 console.log("response", this.userList);
747 }) 806 })
748 .catch((error) => console.log(error)); 807 .catch((error) => console.log(error));
749 }, 808 },
750 809
751 getTemplateList() { 810 getTemplateList() {
752 axios 811 axios
753 .get("/superAdmin/templates", { 812 .get("/superAdmin/templates", {
754 headers: { 813 headers: {
755 Authorization: "Bearer " + this.usertoken, 814 Authorization: "Bearer " + this.usertoken,
756 }, 815 },
757 }) 816 })
758 .then((response) => { 817 .then((response) => {
759 response.data.data.forEach((temp) => { 818 response.data.data.forEach((temp) => {
760 if ( 819 if (
761 temp._id != "INTRO_oqkdMOVDrwRptsdWJ6Ye" && 820 temp._id != "INTRO_oqkdMOVDrwRptsdWJ6Ye" &&
762 temp._id != "OUTRO_oqkdMOVDrwRptsdWJ6Ye" 821 temp._id != "OUTRO_oqkdMOVDrwRptsdWJ6Ye"
763 ) { 822 ) {
764 if (temp.bounceBoard) { 823 if (temp.bounceBoard) {
765 for (var i = 0; i < temp.commentBox; i++) { 824 for (var i = 0; i < temp.commentBox; i++) {
766 temp.metaData.comments.push({ 825 temp.metaData.comments.push({
767 userId: null, 826 userId: null,
768 slideId: null, 827 slideId: null,
769 caseStudyId: null, 828 caseStudyId: null,
770 comment: null, 829 comment: null,
771 }); 830 });
772 } 831 }
773 } 832 }
774 this.templateList.push(temp); 833 this.templateList.push(temp);
775 } 834 }
776 }); 835 });
777 if (this.editMode) { 836 if (this.editMode) {
778 this.getSLideData(); 837 this.getSLideData();
779 } 838 }
780 console.log("templates", this.templateList); 839 console.log("templates", this.templateList);
781 }) 840 })
782 .catch((error) => console.log(error)); 841 .catch((error) => console.log(error));
783 }, 842 },
784 getInsightList() { 843 getInsightList() {
785 axios 844 axios
786 .get("/superAdmin/insight", { 845 .get("/superAdmin/insight", {
787 headers: { 846 headers: {
788 Authorization: "Bearer " + this.usertoken, 847 Authorization: "Bearer " + this.usertoken,
789 }, 848 },
790 }) 849 })
791 .then((response) => { 850 .then((response) => {
792 this.insightList = response.data.data; 851 this.insightList = response.data.data;
793 852
794 console.log("insight", response.data.data); 853 console.log("insight", response.data.data);
795 }) 854 })
796 .catch((error) => console.log(error)); 855 .catch((error) => console.log(error));
797 }, 856 },
798 857
799 getSLideData() { 858 getSLideData() {
800 axios 859 axios
801 .get("/superAdmin/caseStudySlides?caseStudyId=" + this.caseId, { 860 .get("/superAdmin/caseStudySlides?caseStudyId=" + this.caseId, {
802 headers: { 861 headers: {
803 Authorization: "Bearer " + this.usertoken, 862 Authorization: "Bearer " + this.usertoken,
804 }, 863 },
805 }) 864 })
806 .then((response) => { 865 .then((response) => {
807 var finalArray = []; 866 var finalArray = [];
808 response.data.data.forEach((template_) => { 867 response.data.data.forEach((template_) => {
809 console.log("template_",template_) 868 console.log("template_", template_);
810 var keys = []; 869 var keys = [];
811 var i = this.templateList.findIndex( 870 var i = this.templateList.findIndex(
812 (temp_) => temp_._id == template_.templateId 871 (temp_) => temp_._id == template_.templateId
813 ); 872 );
814 var obj = { 873 var obj = {
815 _id: this.templateList[i]._id, 874 _id: this.templateList[i]._id,
816 bounceBoard: this.templateList[i].bounceBoard, 875 bounceBoard: this.templateList[i].bounceBoard,
817 insight: this.templateList[i].insight, 876 insight: this.templateList[i].insight,
818 slideId:template_._id, 877 slideId: template_._id,
819 // commentBox: this.templateList[i].commentBox, 878 // commentBox: this.templateList[i].commentBox,
820 metaData: { 879 metaData: {
821 fields: [], 880 fields: [],
822 comments: [], 881 comments: [],
823 }, 882 },
824 }; 883 };
825 if (this.templateList[i].bounceBoard) { 884 if (this.templateList[i].bounceBoard) {
826 obj.commentBox = this.templateList[i].commentBox; 885 obj.commentBox = this.templateList[i].commentBox;
827 obj.metaData.comments = template_.comments; 886 obj.metaData.comments = template_.comments;
828 } 887 }
829 if (this.templateList[i].insight) { 888 if (this.templateList[i].insight) {
830 obj.insightId = template_.insightId; 889 obj.insightId = template_.insightId;
831 } 890 }
832 var fieldArray = []; 891 var fieldArray = [];
833 this.templateList[i].metaData.fields.forEach((element) => { 892 this.templateList[i].metaData.fields.forEach((element) => {
834 var fieldobj = { 893 var fieldobj = {
835 fieldName: element.fieldName, 894 fieldName: element.fieldName,
836 displayName: element.displayName, 895 displayName: element.displayName,
837 fieldValue: template_.metaData[element.fieldName], 896 fieldValue: template_.metaData[element.fieldName],
838 fieldType: element.fieldType, 897 fieldType: element.fieldType,
839 }; 898 };
840 obj.metaData.fields.push(fieldobj); 899 obj.metaData.fields.push(fieldobj);
841 }); 900 });
842 finalArray.push(obj); 901 finalArray.push(obj);
902 this.insightId = template_.insight._id;
843 }); 903 });
844 this.caseStudy.slides = finalArray; 904 this.caseStudy.slides = finalArray;
845 console.log("----", finalArray); 905 console.log("----", finalArray);
846 console.log(this.templateList, "getSLideData==>"); 906 console.log(this.templateList, "getSLideData==>");
847 }) 907 })
848 .catch((error) => console.log(error)); 908 .catch((error) => console.log(error));
849 }, 909 },
850 910
851 submit() { 911 submit() {
852 const latest = Object.create(this.caseStudy); 912 const latest = Object.create(this.caseStudy);
853 913
854 var slidArray = []; 914 var slidArray = [];
855 latest.slides.forEach((slides) => { 915 latest.slides.forEach((slides) => {
856 console.log("slides", slides); 916 console.log("slides", slides);
857 var slideData = {}; 917 var slideData = {};
858 slideData.templateId = slides._id; 918 slideData.templateId = slides._id;
859 slideData.bounceBoard = slides.bounceBoard; 919 slideData.bounceBoard = slides.bounceBoard;
860 slideData.insight = slides.insight; 920 slideData.insight = slides.insight;
861 if(slides.slideId){ 921 if (slides.slideId) {
862 slideData.slideId = slides.slideId; 922 slideData.slideId = slides.slideId;
863
864 } 923 }
865 if(slides.insightId){ 924 if (slides.insightId) {
866 slideData.insightId = slides.insightId; 925 slideData.insightId = slides.insightId;
867
868 } 926 }
869 if (slides.metaData.comments && slides.metaData.comments.length > 0) { 927 if (slides.metaData.comments && slides.metaData.comments.length > 0) {
870 slideData.comments = slides.metaData.comments; 928 slideData.comments = slides.metaData.comments;
871 // this.getSLideData(); 929 // this.getSLideData();
872 } 930 }
873 // var comments = []; 931 // var comments = [];
874 // if (slides.bounceBoard) { 932 // if (slides.bounceBoard) {
875 // slides.metaData.comments.forEach((element) => { 933 // slides.metaData.comments.forEach((element) => {
876 // comments.push(element.comment); 934 // comments.push(element.comment);
877 // }); 935 // });
878 // slideData.comments = comments; 936 // slideData.comments = comments;
879 // } 937 // }
880 938
881 slides.metaData.fields.forEach((fields_) => { 939 slides.metaData.fields.forEach((fields_) => {
882 slideData[fields_.fieldName] = fields_.fieldValue; 940 slideData[fields_.fieldName] = fields_.fieldValue;
883 }); 941 });
884 slidArray.push(slideData); 942 slidArray.push(slideData);
885 // delete slides.metaData.fields; 943 // delete slides.metaData.fields;
886 }); 944 });
887 945
888 console.log("slideData", slidArray); 946 console.log("slideData", slidArray);
889 if (this.editMode) { 947 if (this.editMode) {
890 this.updateProfile(slidArray); 948 this.updateProfile(slidArray);
891 }else{ 949 } else {
892 this.saveProfile(slidArray); 950 this.saveProfile(slidArray);
893 } 951 }
894 }, 952 },
895 updateComment(cmnt){ 953 updateComment(cmnt) {
896 if(!cmnt._id){ 954 if (!cmnt._id) {
897 return; 955 return;
898 } 956 }
899 console.log("cmnts",cmnt); 957 console.log("cmnts", cmnt);
900 var obj = { 958 var obj = {
901 'slideId':cmnt.slideId, 959 slideId: cmnt.slideId,
902 'commentId':cmnt._id, 960 commentId: cmnt._id,
903 'comment':cmnt.comment 961 comment: cmnt.comment,
904 }; 962 };
905 axios 963 axios
906 .put("/superAdmin/comment", obj, { 964 .put("/superAdmin/comment", obj, {
907 headers: { 965 headers: {
908 Authorization: "Bearer " + this.usertoken, 966 Authorization: "Bearer " + this.usertoken,
909 }, 967 },
910 }) 968 })
911 .then((response) => { 969 .then((response) => {
912
913 console.log(response); 970 console.log(response);
914 }) 971 })
915 .catch((error) => { 972 .catch((error) => {});
916
917 });
918 }, 973 },
919 974
920 saveProfile(slides) { 975 saveProfile(slides) {
921 var obj = {}; 976 var obj = {};
922 obj.caseStudyDetails = this.caseStudy.caseStudyDetails; 977 obj.caseStudyDetails = this.caseStudy.caseStudyDetails;
923 obj.caseStudyDetails.intro.readTime = Math.round( 978 obj.caseStudyDetails.intro.readTime = Math.round(
924 slides.length / 3 979 slides.length / 3
925 ).toString(); 980 ).toString();
926 obj.slides = slides; 981 obj.slides = slides;
927 axios 982 axios
928 .post("/superAdmin/caseStudy", obj, { 983 .post("/superAdmin/caseStudy", obj, {
929 headers: { 984 headers: {
930 Authorization: "Bearer " + this.usertoken, 985 Authorization: "Bearer " + this.usertoken,
931 }, 986 },
932 }) 987 })
933 .then((response) => { 988 .then((response) => {
934 // this.userData = response.data.data; 989 // this.userData = response.data.data;
935 this.$toaster.success("Case Study Created"); 990 this.$toaster.success("Case Study Created");
936 this.$router.go(this.$router.currentRoute) 991 this.$router.go(this.$router.currentRoute);
937 992
938 console.log(response); 993 console.log(response);
939 }) 994 })
940 .catch((error) => { 995 .catch((error) => {
941 if (error.response) { 996 if (error.response) {
942 this.$toaster.error(error.response.data.message); 997 this.$toaster.error(error.response.data.message);
943 } 998 }
944 }); 999 });
945 }, 1000 },
946 1001
947 updateProfile(slides) { 1002 updateProfile(slides) {
948 var obj = {}; 1003 var obj = {};
949 obj.caseStudyId = this.caseId, 1004 (obj.caseStudyId = this.caseId),
950 obj.caseStudyDetails = this.caseStudy.caseStudyDetails; 1005 (obj.caseStudyDetails = this.caseStudy.caseStudyDetails);
951 obj.caseStudyDetails.intro.readTime = Math.round( 1006 obj.caseStudyDetails.intro.readTime = Math.round(
952 slides.length / 3 1007 slides.length / 3
953 ).toString(); 1008 ).toString();
954 obj.slides = slides; 1009 obj.slides = slides;
955 delete obj.caseStudyDetails.intro.focus; 1010 delete obj.caseStudyDetails.intro.focus;
956 axios 1011 axios
957 .put("/superAdmin/caseStudy", obj, { 1012 .put("/superAdmin/caseStudy", obj, {
958 headers: { 1013 headers: {
959 Authorization: "Bearer " + this.usertoken, 1014 Authorization: "Bearer " + this.usertoken,
960 }, 1015 },
961 }) 1016 })
962 .then((response) => { 1017 .then((response) => {
963 // this.userData = response.data.data; 1018 // this.userData = response.data.data;
964 this.$toaster.success("Case Study Updated"); 1019 this.$toaster.success("Case Study Updated");
965 this.$router.go(this.$router.currentRoute) 1020 this.$router.go(this.$router.currentRoute);
966
967 1021
968 console.log(response); 1022 console.log(response);
969 }) 1023 })
970 .catch((error) => { 1024 .catch((error) => {
971 if (error.response) { 1025 if (error.response) {
972 this.$toaster.error(error.response.data.message); 1026 this.$toaster.error(error.response.data.message);
973 } 1027 }
974 }); 1028 });
975 }, 1029 },
976 listPage(url){ 1030 listPage(url) {
977 this.$router.push(url); 1031 this.$router.push(url);
978 }, 1032 },
979 1033
980 addProfileDialog(slide) { 1034 addProfileDialog(slide) {
981 console.log("slide",slide) 1035 console.log("slide", slide);
982 this.templateImage = slide.templateImage; 1036 this.templateImage = slide.templateImage;
983 $(".inner-wrp").addClass("body-blur"); 1037 $(".inner-wrp").addClass("body-blur");
984 $("#add-social-links").hide(); 1038 $("#add-social-links").hide();
985 $(".popup-wrp, #add-profile").show(); 1039 $(".popup-wrp, #add-profile").show();
986 }, 1040 },
987 1041
988 closeDialog() { 1042 closeDialog() {
989 this.templateImage = null; 1043 this.templateImage = null;
990 $(".popup-wrp").hide(); 1044 $(".popup-wrp").hide();
991 $(".inner-wrp").removeClass("body-blur"); 1045 $(".inner-wrp").removeClass("body-blur");
992 // this.saveProfile(); 1046 // this.saveProfile();
993 }, 1047 },
994 hideDialog() { 1048 hideDialog() {
995 this.templateImage = null; 1049 this.templateImage = null;
996 $(".popup-wrp").hide(); 1050 $(".popup-wrp").hide();
997 $(".inner-wrp").removeClass("body-blur"); 1051 $(".inner-wrp").removeClass("body-blur");
998 }, 1052 },
999 1053
1000 async getMeatda(tempId) { 1054 async getMeatda(tempId) {
1001 var obj = [ 1055 var obj = [
1002 { 1056 {
1003 tempId: "T1_RoeMG8130Xko1DvhC3Ou", 1057 tempId: "T1_RoeMG8130Xko1DvhC3Ou",
1004 metaData: { 1058 metaData: {
1005 fields: [ 1059 fields: [
1006 { 1060 {
1007 fieldName: "authorImage", 1061 fieldName: "authorImage",
1008 displayName: "Author Image", 1062 displayName: "Author Image",
1009 fieldValue: null, 1063 fieldValue: null,
1010 fieldType: "image", 1064 fieldType: "image",
1011 }, 1065 },
1012 { 1066 {
1013 fieldName: "mobileImage", 1067 fieldName: "mobileImage",
1014 displayName: "Mobile Image", 1068 displayName: "Mobile Image",
1015 fieldValue: null, 1069 fieldValue: null,
1016 fieldType: "image", 1070 fieldType: "image",
1017 }, 1071 },
1018 { 1072 {
1019 fieldName: "textBox", 1073 fieldName: "textBox",
1020 displayName: "Text Box", 1074 displayName: "Text Box",
1021 fieldValue: null, 1075 fieldValue: null,
1022 fieldType: "text", 1076 fieldType: "text",
1023 }, 1077 },
1024 ], 1078 ],
1025 }, 1079 },
1026 }, 1080 },
1027 { 1081 {
1028 tempId: "T2_ROsUOEy3vxsRAiQ72XdI", 1082 tempId: "T2_ROsUOEy3vxsRAiQ72XdI",
1029 metaData: { 1083 metaData: {
1030 fields: [ 1084 fields: [
1031 { 1085 {
1032 fieldName: "authorImage", 1086 fieldName: "authorImage",
1033 displayName: "Author Image", 1087 displayName: "Author Image",
1034 fieldValue: null, 1088 fieldValue: null,
1035 fieldType: "image", 1089 fieldType: "image",
1036 }, 1090 },
1037 ], 1091 ],
1038 comments: [{ comment: null }, { comment: null }, { comment: null }], 1092 comments: [{ comment: null }, { comment: null }, { comment: null }],
1039 }, 1093 },
1040 }, 1094 },
1041 { 1095 {
1042 tempId: "T3_cqNIf7tuqL4jyON63dA7", 1096 tempId: "T3_cqNIf7tuqL4jyON63dA7",
1043 metaData: { 1097 metaData: {
1044 fields: [ 1098 fields: [