Blame view

src/components/Profile.vue 22.5 KB
f06677bfc   Digvijay Singh   profile screen added
1
2
  <template>
    <main class="landing-page">
298fff252   Digvijay Singh   new design added
3
      <!-- profile -->
0ad3ed4de   Digvijay Singh   adin panel changes
4
      <div class="container-fluid inner-wrp" style="background: transparent">
f06677bfc   Digvijay Singh   profile screen added
5
        <nav class="navbar navbar-expand-sm spotLight-nav">
298fff252   Digvijay Singh   new design added
6
7
8
9
10
11
12
13
14
15
16
17
          <a class="navbar-brand" href="#"
            ><img src="../assets/images/logo.png"
          /></a>
          <button
            class="navbar-toggler"
            type="button"
            data-toggle="collapse"
            data-target="#navbarsExample03"
            aria-controls="navbarsExample03"
            aria-expanded="false"
            aria-label="Toggle navigation"
          >
f06677bfc   Digvijay Singh   profile screen added
18
19
20
21
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
          </button>
298fff252   Digvijay Singh   new design added
22

f06677bfc   Digvijay Singh   profile screen added
23
24
25
          <div class="collapse navbar-collapse" id="navbarsExample03">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
0ad3ed4de   Digvijay Singh   adin panel changes
26
                <a class="nav-link">Create Case Study</a>
f06677bfc   Digvijay Singh   profile screen added
27
28
29
              </li>
            </ul>
          </div>
0ad3ed4de   Digvijay Singh   adin panel changes
30
31
          <div class="">
            <a href="javascript:void(0);" @click="logout">Log Out </a>
f06677bfc   Digvijay Singh   profile screen added
32
          </div>
298fff252   Digvijay Singh   new design added
33
34
35
        </nav>
        <!-- menu wrapper -->
        <div class="row profile-tab-spc-top">
0ad3ed4de   Digvijay Singh   adin panel changes
36
37
38
39
40
41
42
43
44
45
46
47
48
49
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="user-profile">
              <div class="form-group floating-label">
                <select
                  class="form-control"
                  v-model="userData"
                  v-on:change="selectUser(userData)"
                >
                  <option value="null">Select User</option>
                  <option v-for="(user, i) in userList" :key="i" :value="i">
                    {{ user.name }} ({{ user.email }})
                  </option>
                </select>
              </div>
5684145ce   Digvijay Singh   reset password,ot...
50
            </div>
0ad3ed4de   Digvijay Singh   adin panel changes
51
52
          </div>
        </div>
5684145ce   Digvijay Singh   reset password,ot...
53

0ad3ed4de   Digvijay Singh   adin panel changes
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
        <div class="row">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <h5 class="nav-link">Intro Screen Record</h5>
              </li>
            </ul>
          </div>
        </div>
        <!-- 1st row -->
        <div class="row">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Case Study Name</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.intro.name"
              />
            </div>
          </div>
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">App Name</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.intro.app"
              />
            </div>
          </div>
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Focus</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.intro.focus"
              />
            </div>
          </div>
        </div>
        <!-- 1st row end -->
  
        <!-- 2nd row -->
        <div class="row">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Case Study Type</label>
              <select
                class="form-control"
                v-model="caseStudy.caseStudyDetails.intro.type"
              >
                <option value="null">Select Case Type</option>
                <option value="Retake">Retake</option>
                <option value="Behind-the-scenes">Behind-the-scenes</option>
                <option value="Critique">Critique</option>
                <option value="Juxtapose">Juxtapose</option>
              </select>
            </div>
          </div>
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Platform</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.intro.platForm"
              />
            </div>
          </div>
  
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname"> Insight Logo</label>
              <input
                @change="createImage('logo')"
                type="file"
                name="photso"
                id="logo"
                accept="image/*"
              />
            </div>
          </div>
        </div>
        <!-- 2nd row -->
        <!-- 3rd row -->
        <div class="row">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname"></label>
              <ul class="interests">
5684145ce   Digvijay Singh   reset password,ot...
154
                <li>
0ad3ed4de   Digvijay Singh   adin panel changes
155
156
157
158
159
160
161
162
                  <input
                    class=""
                    placeholder="Add Focus Areas"
                    v-model="focusName"
                  />
                  <a href="javascript:void(0);" @click="addInsight('focus')"
                    ><img src="../assets/images/plus-circle.svg"
                  /></a>
5684145ce   Digvijay Singh   reset password,ot...
163
                </li>
0ad3ed4de   Digvijay Singh   adin panel changes
164
165
166
167
168
169
170
171
172
173
174
175
  
                <li
                  v-for="(interest, i) in caseStudy.caseStudyDetails.focusAreas"
                  :key="i"
                >
                  <span>{{ interest }}</span>
                  <a
                    href="javascript:void(0);"
                    @click="removeInsight(i, 'focus')"
                    class="cat-minus"
                    ><img src="../assets/images/minus.svg"
                  /></a>
5684145ce   Digvijay Singh   reset password,ot...
176
                </li>
298fff252   Digvijay Singh   new design added
177
              </ul>
298fff252   Digvijay Singh   new design added
178
179
            </div>
          </div>
0ad3ed4de   Digvijay Singh   adin panel changes
180
181
182
183
184
  
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname"></label>
              <ul class="interests">
298fff252   Digvijay Singh   new design added
185
                <li>
0ad3ed4de   Digvijay Singh   adin panel changes
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
                  <input
                    class=""
                    placeholder="Add Insight Tags"
                    v-model="insightName"
                  />
                  <a href="javascript:void(0);" @click="addInsight('insight')"
                    ><img src="../assets/images/plus-circle.svg"
                  /></a>
                </li>
  
                <li
                  v-for="(interest, i) in caseStudy.caseStudyDetails.insightTags"
                  :key="i"
                >
                  <span>{{ interest }}</span>
                  <a
                    href="javascript:void(0);"
                    @click="removeInsight(i, 'insight')"
                    class="cat-minus"
                    ><img src="../assets/images/minus.svg"
                  /></a>
298fff252   Digvijay Singh   new design added
207
208
209
                </li>
              </ul>
            </div>
298fff252   Digvijay Singh   new design added
210
          </div>
f06677bfc   Digvijay Singh   profile screen added
211
        </div>
0ad3ed4de   Digvijay Singh   adin panel changes
212
213
214
215
216
217
218
219
        <!-- 3rd row end -->
  
        <!-- outdor -->
        <div class="row profile-tab-spc-top">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <h5 class="nav-link">Outro Screen Record</h5>
5684145ce   Digvijay Singh   reset password,ot...
220
              </li>
298fff252   Digvijay Singh   new design added
221
222
            </ul>
          </div>
0ad3ed4de   Digvijay Singh   adin panel changes
223
224
225
226
        </div>
  
        <!-- 1st row -->
        <div class="row">
298fff252   Digvijay Singh   new design added
227
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
0ad3ed4de   Digvijay Singh   adin panel changes
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
            <div class="form-group floating-label">
              <label for="lname" class="lname">Designer Name</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.outro.designer"
              />
            </div>
          </div>
  
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Illustrations Name</label>
              <input
                type="text"
                class="form-control"
                value=""
                placeholder=" "
                v-model="caseStudy.caseStudyDetails.outro.illustrations"
              />
            </div>
          </div>
  
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname"> Author Image</label>
              <input
                @change="createImage('outdor')"
                type="file"
                name="photos"
                id="outdor"
                accept="image/*"
              />
            </div>
          </div>
        </div>
        <!-- 1st row -->
        <!-- outdoor ends -->
  
        <!-- outdor -->
        <div class="row profile-tab-spc-top">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <h5 class="nav-link">Add SLides</h5>
298fff252   Digvijay Singh   new design added
275
276
277
278
              </li>
            </ul>
          </div>
        </div>
0ad3ed4de   Digvijay Singh   adin panel changes
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
  
        <!-- 1st row -->
        <div class="row">
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <div class="form-group floating-label">
              <label for="lname" class="lname">Slides Name</label>
              <select
                class="form-control"
                v-model="slideId"
                v-on:change="slideSelected(slideId)"
              >
                <option value="null">Select Slide</option>
                <option v-for="(template, i) in templateList" :key="i" :value="i">
                  {{ template._id }}
                </option>
              </select>
            </div>
          </div>
        </div>
        <!-- 1st row -->
  
        <!-- case study  slides-->
        <div
          class="row profile-tab-spc-top"
          v-for="(slide, i) in caseStudy.slides"
          :key="i"
        >
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <p class="nav-link">
                  <b>Screen {{ i + 1 }}</b>
5684145ce   Digvijay Singh   reset password,ot...
311
                  <a
0ad3ed4de   Digvijay Singh   adin panel changes
312
313
                    style="cursor: pointer; color: red; font-size: 0.8rem"
                    @click="removeSlide(i)"
298fff252   Digvijay Singh   new design added
314
                  >
0ad3ed4de   Digvijay Singh   adin panel changes
315
                    Remove</a
298fff252   Digvijay Singh   new design added
316
                  >
0ad3ed4de   Digvijay Singh   adin panel changes
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
                </p>
              </li>
            </ul>
          </div>
  
          <div class="row">
            <div
              class="col-sm-4 col-md-4 col-lg-4 col-xl-4"
              v-for="(field, j) in slide.metaData.fields"
              :key="j"
            >
              <div
                class="form-group floating-label"
                v-if="field.fieldType == 'text'"
              >
                <label for="lname" class="lname">{{ field.displayName }}</label>
                <input
                  type="text"
                  class="form-control"
                  value=""
                  placeholder=" "
                  v-model="field.fieldValue"
                />
              </div>
  
              <div
                class="form-group floating-label"
                v-if="field.fieldType == 'image'"
              >
                <label for="lname" class="lname"> {{ field.displayName }}</label>
                <input
                  @change="fieldcreateImage(i, j)"
                  type="file"
                  name="photo"
                  :id="i + '' + j"
                  accept="image/*"
                />
298fff252   Digvijay Singh   new design added
354
355
              </div>
            </div>
5684145ce   Digvijay Singh   reset password,ot...
356
          </div>
0ad3ed4de   Digvijay Singh   adin panel changes
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
  
          <div class="row">
            <div
              class="col-sm-4 col-md-4 col-lg-4 col-xl-4"
              v-for="(cum, j) in slide.metaData.comments"
              :key="j"
            >
              <div class="form-group floating-label">
                <label for="lname" class="lname">Comment Box {{ j + 1 }}</label>
                <input
                  type="text"
                  class="form-control"
                  value=""
                  placeholder=" "
                  v-model="cum.comment"
                />
5684145ce   Digvijay Singh   reset password,ot...
373
              </div>
5684145ce   Digvijay Singh   reset password,ot...
374
375
            </div>
          </div>
298fff252   Digvijay Singh   new design added
376
        </div>
0ad3ed4de   Digvijay Singh   adin panel changes
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
  
        <!-- 1st row end -->
        <!-- case study ends -->
        <div class="clearfix"></div>
  
        <!-- users land image -->
        <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
          <div class="form-layout signup-frm-spc">
            <form>
              <a
                href="javascript:void(0);"
                class="btn btn-lg sb-button"
                type="submit"
                @click="submit"
              >
                <img src="../assets/images/key.svg" /> submit
              </a>
            </form>
          </div>
        </div>
298fff252   Digvijay Singh   new design added
397
        <!-- data wrp -->
f06677bfc   Digvijay Singh   profile screen added
398
399
400
401
402
403
        <!-- body wrapper -->
      </div>
    </main>
  </template>
  
  <script>
f06677bfc   Digvijay Singh   profile screen added
404
405
406
  import Vue from "vue";
  import router from "../router";
  import $ from "jquery";
5684145ce   Digvijay Singh   reset password,ot...
407
  import axios from "axios";
f06677bfc   Digvijay Singh   profile screen added
408
409
410
411
412
413
414
  
  export default {
    name: "Profile",
  
    data() {
      return {
        loggedinFlag: false,
0ad3ed4de   Digvijay Singh   adin panel changes
415
        userData: null,
298fff252   Digvijay Singh   new design added
416
        usertoken: null,
0ad3ed4de   Digvijay Singh   adin panel changes
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
        insightName: null,
        focusName: null,
        slideId: null,
        userList: [],
        templateList: [],
        caseStudy: {
          caseStudyDetails: {
            userId: [],
            intro: {
              name: null,
              logoURL: null,
              app: null,
              type: null,
              focus: null,
              readTime: null,
              platForm: null,
              authors: [],
            },
            outro: {
              authorImage: [],
              authors: [],
              designer: null,
              illustrations: null,
            },
            insightTags: [],
            focusAreas: [],
          },
          slides: [],
        },
f06677bfc   Digvijay Singh   profile screen added
446
447
      };
    },
298fff252   Digvijay Singh   new design added
448
449
450
451
452
    mounted() {
      var userdata = localStorage.getItem("spotlight_usertoken");
      if (userdata) {
        userdata = JSON.parse(userdata);
        this.usertoken = userdata.token;
0ad3ed4de   Digvijay Singh   adin panel changes
453
454
        this.getUserList();
        this.getTemplateList();
298fff252   Digvijay Singh   new design added
455
      }
298fff252   Digvijay Singh   new design added
456
    },
f06677bfc   Digvijay Singh   profile screen added
457
    methods: {
0ad3ed4de   Digvijay Singh   adin panel changes
458
459
460
461
462
463
      selectUser(i) {
        this.userList[i];
        this.caseStudy.caseStudyDetails.intro.authors.push(this.userList[i].name);
        this.caseStudy.caseStudyDetails.outro.authors.push(this.userList[i].name);
        this.caseStudy.caseStudyDetails.userId.push(this.userList[i]._id);
        console.log("-", this.caseStudy);
f06677bfc   Digvijay Singh   profile screen added
464
      },
0ad3ed4de   Digvijay Singh   adin panel changes
465

5684145ce   Digvijay Singh   reset password,ot...
466
467
468
      logout() {
        this.$router.push("/");
      },
0ad3ed4de   Digvijay Singh   adin panel changes
469
470
471
472
473
474
475
476
      addInsight(type) {
        if (type == "focus") {
          this.caseStudy.caseStudyDetails.focusAreas.push(this.focusName);
          this.focusName = null;
        } else if (type == "insight") {
          this.caseStudy.caseStudyDetails.insightTags.push(this.insightName);
          this.insightName = null;
        }
5684145ce   Digvijay Singh   reset password,ot...
477
      },
0ad3ed4de   Digvijay Singh   adin panel changes
478
479
480
481
482
      removeInsight(i, type) {
        if (type == "focus") {
          this.caseStudy.caseStudyDetails.focusAreas.splice(i, 1);
        } else if (type == "insight") {
          this.caseStudy.caseStudyDetails.insightTags.splice(i, 1);
5684145ce   Digvijay Singh   reset password,ot...
483
484
        }
      },
0ad3ed4de   Digvijay Singh   adin panel changes
485
486
487
488
489
490
491
492
493
  
      async slideSelected(i) {
        console.log("id is", this.templateList[i]);
        var slideMetadata = {};
        // slideMetadata = await this.getMeatda(this.templateList[i]._id);
        this.slideId = null;
        // this.templateList[i].metaData = slideMetadata.metaData;
        this.caseStudy.slides.push(this.templateList[i]);
        console.log("this.caseStudy.slides", this.caseStudy.slides);
5684145ce   Digvijay Singh   reset password,ot...
494
      },
0ad3ed4de   Digvijay Singh   adin panel changes
495
496
497
  
      removeSlide(i) {
        this.caseStudy.slides.splice(i, 1);
5684145ce   Digvijay Singh   reset password,ot...
498
      },
5684145ce   Digvijay Singh   reset password,ot...
499

0ad3ed4de   Digvijay Singh   adin panel changes
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
      createImage(type) {
        var that = this;
        console.log(document.getElementById(type));
        var file = document.getElementById(type).files[0];
        console.log("file", file);
        var reader = new FileReader();
        reader.onload = function (e) {
          console.log("e.target.result  ", e.target.result);
          that.uploadImage(type, e.target.result);
        };
        reader.onerror = function (error) {
          alert(error);
        };
        if (file) {
          reader.readAsDataURL(file);
        }
5684145ce   Digvijay Singh   reset password,ot...
516
      },
0ad3ed4de   Digvijay Singh   adin panel changes
517
518
519
520
521
      uploadImage(type, base64) {
        console.log("type", type);
        var obj = {
          image: base64,
        };
298fff252   Digvijay Singh   new design added
522
        axios
0ad3ed4de   Digvijay Singh   adin panel changes
523
          .post("/superAdmin/uploadImage", obj, {
5684145ce   Digvijay Singh   reset password,ot...
524
525
526
527
528
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
0ad3ed4de   Digvijay Singh   adin panel changes
529
530
531
532
533
534
535
            if (type == "logo") {
              this.caseStudy.caseStudyDetails.intro.logoURL = response.data.data;
            } else if (type == "outdor") {
              this.caseStudy.caseStudyDetails.outro.authorImage = [];
              this.caseStudy.caseStudyDetails.outro.authorImage.push(
                response.data.data
              );
052b5bc33   Digvijay Singh   close dialog
536
            }
5684145ce   Digvijay Singh   reset password,ot...
537

5684145ce   Digvijay Singh   reset password,ot...
538
            console.log(response.data.data);
0ad3ed4de   Digvijay Singh   adin panel changes
539
            console.log(this.caseStudy);
5684145ce   Digvijay Singh   reset password,ot...
540
          })
0ad3ed4de   Digvijay Singh   adin panel changes
541
542
543
544
545
          .catch((error) => {
            if (error.response) {
              this.$toaster.error(error.response.data.message);
            }
          });
298fff252   Digvijay Singh   new design added
546
      },
0ad3ed4de   Digvijay Singh   adin panel changes
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
  
      fieldcreateImage(i, j) {
        console.log("i", i);
        console.log("j", j);
        var that = this;
        var id = i + "" + j;
        console.log(document.getElementById(id));
        var file = document.getElementById(id).files[0];
        // var file = document.querySelector("input[type=file]").files[0];
        console.log("file", file);
        var reader = new FileReader();
        reader.onload = function (e) {
          // console.log("e.target.result  ",e.target.result  )
          that.fielduploadImage(i, j, e.target.result);
        };
        reader.onerror = function (error) {
          alert(error);
        };
        if (file) {
          reader.readAsDataURL(file);
        }
      },
      fielduploadImage(i, j, base64) {
        var obj = {
          image: base64,
        };
5684145ce   Digvijay Singh   reset password,ot...
573
        axios
0ad3ed4de   Digvijay Singh   adin panel changes
574
          .post("/superAdmin/uploadImage", obj, {
298fff252   Digvijay Singh   new design added
575
576
577
578
579
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
0ad3ed4de   Digvijay Singh   adin panel changes
580
581
            this.caseStudy.slides[i].metaData.fields[j].fieldValue =
              response.data.data;
298fff252   Digvijay Singh   new design added
582
            console.log(response.data.data);
0ad3ed4de   Digvijay Singh   adin panel changes
583
            console.log(this.caseStudy);
298fff252   Digvijay Singh   new design added
584
          })
5684145ce   Digvijay Singh   reset password,ot...
585
586
587
588
589
          .catch((error) => {
            if (error.response) {
              this.$toaster.error(error.response.data.message);
            }
          });
298fff252   Digvijay Singh   new design added
590
      },
0ad3ed4de   Digvijay Singh   adin panel changes
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
  
      getUserList() {
        axios
          .get("/superAdmin/users", {
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
            response.data.data.forEach((element) => {
              if (element.name) {
                this.userList.push(element);
              }
            });
            console.log("response", this.userList);
          })
          .catch((error) => console.log(error));
298fff252   Digvijay Singh   new design added
608
      },
0ad3ed4de   Digvijay Singh   adin panel changes
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
  
      getTemplateList() {
        axios
          .get("/superAdmin/templates", {
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
            response.data.data.forEach((temp) => {
              if (
                temp._id != "INTRO_oqkdMOVDrwRptsdWJ6Ye" &&
                temp._id != "OUTRO_oqkdMOVDrwRptsdWJ6Ye"
              ) {
                if (temp.bounceBoard) {
                  for (var i = 0; i < temp.commentBox; i++) {
                    temp.metaData.comments.push({
                      userId: null,
                      slideId: null,
                      caseStudyId: null,
                      comment: null,
                    });
                  }
                }
                this.templateList.push(temp);
              }
            });
            console.log("templates", this.templateList);
          })
          .catch((error) => console.log(error));
1620582c6   Digvijay Singh   close dialog
639
      },
0ad3ed4de   Digvijay Singh   adin panel changes
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
  
      submit() {
        const latest = Object.create(this.caseStudy);
  
        var slidArray = [];
        latest.slides.forEach((slides) => {
          console.log("slides",slides)
          var slideData = {};
          slideData.templateId = slides._id;
          slideData.bounceBoard = slides.bounceBoard;
          slideData.insight = slides.insight;
          // var comments = [];
          // if (slides.bounceBoard) {
          //   slides.metaData.comments.forEach((element) => {
          //     comments.push(element.comment);
          //   });
          //   slideData.comments = comments;
          // }
  
          slides.metaData.fields.forEach((fields_) => {
            slideData[fields_.fieldName] = fields_.fieldValue;
          });
          slidArray.push(slideData);
          // delete slides.metaData.fields;
        });
  
        console.log("slideData", slidArray);
        this.saveProfile(slidArray);
5684145ce   Digvijay Singh   reset password,ot...
668
      },
0ad3ed4de   Digvijay Singh   adin panel changes
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
  
      saveProfile(slides) {
        var obj = {};
        obj.caseStudyDetails = this.caseStudy.caseStudyDetails;
        obj.caseStudyDetails.intro.readTime = Math.round(
          slides.length / 3
        ).toString();
        obj.slides = slides;
        axios
          .post("/superAdmin/caseStudy", obj, {
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
            // this.userData = response.data.data;
            this.$toaster.success("Case Study Created");
  
            console.log(response);
          })
          .catch((error) => {
            if (error.response) {
              this.$toaster.error(error.response.data.message);
            }
          });
5684145ce   Digvijay Singh   reset password,ot...
694
      },
24ced0ae7   Gurvinder Singh   new changes files
695

0ad3ed4de   Digvijay Singh   adin panel changes
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
      async getMeatda(tempId) {
        var obj = [
          {
            tempId: "T1_RoeMG8130Xko1DvhC3Ou",
            metaData: {
              fields: [
                {
                  fieldName: "authorImage",
                  displayName: "Author Image",
                  fieldValue: null,
                  fieldType: "image",
                },
                {
                  fieldName: "mobileImage",
                  displayName: "Mobile Image",
                  fieldValue: null,
                  fieldType: "image",
                },
                {
                  fieldName: "textBox",
                  displayName: "Text Box",
                  fieldValue: null,
                  fieldType: "text",
                },
              ],
            },
          },
          {
            tempId: "T2_ROsUOEy3vxsRAiQ72XdI",
            metaData: {
              fields: [
                {
                  fieldName: "authorImage",
                  displayName: "Author Image",
                  fieldValue: null,
                  fieldType: "image",
                },
              ],
              comments: [{ comment: null }, { comment: null }, { comment: null }],
            },
          },
          {
            tempId: "T3_cqNIf7tuqL4jyON63dA7",
            metaData: {
              fields: [
                {
                  fieldName: "authorImage",
                  displayName: "Author Image",
                  fieldValue: null,
                  fieldType: "image",
                },
                {
                  fieldName: "mobileImage",
                  displayName: "Mobile Image",
                  fieldValue: null,
                  fieldType: "image",
                },
              ],
              comments: [
                { comment: null },
                { comment: null },
                { comment: null },
                { comment: null },
              ],
            },
          },
        ];
        var i = obj.findIndex((obj_) => obj_.tempId == tempId);
        return obj[i];
5684145ce   Digvijay Singh   reset password,ot...
765
      },
f06677bfc   Digvijay Singh   profile screen added
766
767
768
    },
  };
  </script>