Commit 3986e5ad71cacf1e96eba1acc1f33a8a22060ee7

Authored by Digvijay Singh
1 parent 74dbc1d9ff
Exists in admin

new changes in admin panel

src/components/CaseStudy.vue
... ... @@ -23,10 +23,10 @@
23 23 <div class="collapse navbar-collapse" id="navbarsExample03">
24 24 <ul class="navbar-nav mr-auto">
25 25 <li class="nav-item active">
26   - <a class="nav-link" @click="create" style="cursor:pointer">Create Case Study</a>
  26 + <a class="nav-link" @click="create('/profile')" style="cursor:pointer">Create Case Study</a>
27 27 </li>
28 28 <li class="nav-item active">
29   - <a class="nav-link" style="cursor:pointer">Create Insight</a>
  29 + <a class="nav-link" @click="create('/insight')" style="cursor:pointer">Create Insight</a>
30 30 </li>
31 31 </ul>
32 32 </div>
... ... @@ -131,8 +131,8 @@ export default {
131 131 localStorage.setItem('spotlight_caseStudy'+payload._id, JSON.stringify(payload))
132 132 this.$router.push("/profile?"+payload._id);
133 133 },
134   - create(){
135   - this.$router.push("/profile");
  134 + create(url){
  135 + this.$router.push(url);
136 136 },
137 137 logout(){
138 138 this.$router.push("/");
... ...
src/components/Insight.vue
... ... @@ -0,0 +1,264 @@
  1 +<template>
  2 + <main class="landing-page">
  3 + <!-- profile -->
  4 + <div class="container-fluid inner-wrp" style="background: transparent">
  5 + <nav class="navbar navbar-expand-sm spotLight-nav">
  6 + <a class="navbar-brand" href="#"
  7 + ><img src="../assets/images/logo.png"
  8 + /></a>
  9 + <button
  10 + class="navbar-toggler"
  11 + type="button"
  12 + data-toggle="collapse"
  13 + data-target="#navbarsExample03"
  14 + aria-controls="navbarsExample03"
  15 + aria-expanded="false"
  16 + aria-label="Toggle navigation"
  17 + >
  18 + <span class="navbar-toggler-icon"></span>
  19 + <span class="navbar-toggler-icon"></span>
  20 + <span class="navbar-toggler-icon"></span>
  21 + </button>
  22 +
  23 + <div class="collapse navbar-collapse" id="navbarsExample03">
  24 + <ul class="navbar-nav mr-auto">
  25 + <li class="nav-item active">
  26 + <a
  27 + class="nav-link"
  28 + @click="create('/profile')"
  29 + style="cursor: pointer"
  30 + >Create Case Study</a
  31 + >
  32 + </li>
  33 + <li class="nav-item active">
  34 + <a
  35 + class="nav-link"
  36 + @click="create('/casestudy')"
  37 + style="cursor: pointer"
  38 + >Case Study List</a
  39 + >
  40 + </li>
  41 + </ul>
  42 + </div>
  43 + <div class="">
  44 + <a href="javascript:void(0);" @click="logout">Log Out </a>
  45 + </div>
  46 + </nav>
  47 + <!-- menu wrapper -->
  48 + <!-- <div class="row profile-tab-spc-top">
  49 + <div class="col-sm-3 col-md-3 col-lg-3 col-xl-3">
  50 + <div class="user-profile">
  51 + <div class="form-group floating-label">
  52 + <select
  53 + class="form-control"
  54 + v-model="userData"
  55 + v-on:change="selectUser(userData)"
  56 + >
  57 + <option value="null">Select User</option>
  58 + <option v-for="(user, i) in userList" :key="i" :value="i">
  59 + {{ user.name }} ({{ user.email }})
  60 + </option>
  61 + </select>
  62 + </div>
  63 + </div>
  64 + </div>
  65 + </div> -->
  66 +
  67 + <!-- 1st row -->
  68 + <div class="row">
  69 + <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
  70 + <div class="form-group floating-label">
  71 + <label for="lname" class="lname">Case Study Type</label>
  72 + <select
  73 + class="form-control"
  74 + v-model="userData.tag"
  75 + >
  76 + <option value="null">Select Case Type</option>
  77 + <option value="Retake">Retake</option>
  78 + <option value="Behind-the-scenes">Behind-the-scenes</option>
  79 + <option value="Critique">Critique</option>
  80 + <option value="Juxtapose">Juxtapose</option>
  81 + </select>
  82 + </div>
  83 + </div>
  84 + <div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
  85 + <div class="form-group floating-label">
  86 + <label for="lname" class="lname">Title</label>
  87 + <input
  88 + type="text"
  89 + class="form-control"
  90 + value=""
  91 + placeholder=" "
  92 + v-model="userData.title"
  93 + />
  94 + </div>
  95 + </div>
  96 +
  97 +
  98 + </div>
  99 + <!-- 1st row -->
  100 + <!-- 2nd row -->
  101 + <div class="row">
  102 + <div class="col-sm-8 col-md-8 col-lg-8 col-xl-8">
  103 + <div class="form-group floating-label">
  104 + <label for="lname" class="lname">Description</label>
  105 + <input
  106 + type="text"
  107 + class="form-control"
  108 + value=""
  109 + placeholder=" "
  110 + v-model="userData.description"
  111 + />
  112 + </div>
  113 + </div>
  114 +
  115 +
  116 + </div>
  117 + <!-- 2nd row -->
  118 + <!-- 3rd row -->
  119 + <div class="row">
  120 + <div class="form-layout signup-frm-spc" style="margin-top:10px">
  121 + <form>
  122 + <a
  123 + href="javascript:void(0);"
  124 + class="btn btn-lg sb-button"
  125 + type="submit"
  126 + @click="submit"
  127 + >
  128 + <img src="../assets/images/key.svg" /> submit
  129 + </a>
  130 + </form>
  131 + </div>
  132 +
  133 +
  134 + </div>
  135 + <!-- 3rd row -->
  136 +
  137 + <div class="row">
  138 + <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
  139 + <ul class="navbar-nav mr-auto">
  140 + <li class="nav-item active">
  141 + <h5 class="nav-link">
  142 + <span style="cursor: pointer">Insight List</span>
  143 + </h5>
  144 + </li>
  145 + </ul>
  146 + </div>
  147 + </div>
  148 + <div class="row">
  149 + <table>
  150 + <tr>
  151 + <th>Id</th>
  152 + <th>Tag</th>
  153 + <th>Title</th>
  154 + <th>Action</th>
  155 + </tr>
  156 + <tr v-for="(insight, j) in insightList" :key="j">
  157 + <td>{{ insight._id }}</td>
  158 + <td>{{ insight.tag }}</td>
  159 + <td>{{ insight.title }}</td>
  160 + <td><a style="cursor: pointer">Delete</a></td>
  161 + </tr>
  162 + </table>
  163 + </div>
  164 + <!-- 1st row -->
  165 + </div>
  166 + </main>
  167 +</template>
  168 +
  169 +<script>
  170 +import Vue from "vue";
  171 +import router from "../router";
  172 +import $ from "jquery";
  173 +import axios from "axios";
  174 +
  175 +export default {
  176 + name: "Insight",
  177 +
  178 + data() {
  179 + return {
  180 + loggedinFlag: false,
  181 + usertoken: null,
  182 + userData: {
  183 + tag: null,
  184 + title: null,
  185 + description:
  186 + null,
  187 + furtherReading: [],
  188 + },
  189 + insightList: [],
  190 + };
  191 + },
  192 + mounted() {
  193 + var userdata = localStorage.getItem("spotlight_usertoken");
  194 + if (userdata) {
  195 + userdata = JSON.parse(userdata);
  196 + this.usertoken = userdata.token;
  197 + this.getInsight();
  198 + }
  199 + },
  200 + methods: {
  201 + getInsight() {
  202 + axios
  203 + .get("/superAdmin/insight", {
  204 + headers: {
  205 + Authorization: "Bearer " + this.usertoken,
  206 + },
  207 + })
  208 + .then((response) => {
  209 + this.insightList = response.data.data;
  210 + console.log("response", response.data.data);
  211 + })
  212 + .catch((error) => console.log(error));
  213 + },
  214 + submit() {
  215 + axios
  216 + .post("/superAdmin/insight", this.userData, {
  217 + headers: {
  218 + Authorization: "Bearer " + this.usertoken,
  219 + },
  220 + })
  221 + .then((response) => {
  222 + // this.userData = response.data.data;
  223 + this.$toaster.success("Insight Created");
  224 + this.$router.go(this.$router.currentRoute)
  225 +
  226 + console.log(response);
  227 + })
  228 + .catch((error) => {
  229 + if (error.response) {
  230 + this.$toaster.error(error.response.data.message);
  231 + }
  232 + });
  233 + },
  234 + create(url) {
  235 + this.$router.push(url);
  236 + },
  237 + logout() {
  238 + this.$router.push("/");
  239 + },
  240 + },
  241 +};
  242 +</script>
  243 +<style>
  244 +.light-font-weight {
  245 + font-weight: 300 !important;
  246 +}
  247 +
  248 +table {
  249 + font-family: arial, sans-serif;
  250 + border-collapse: collapse;
  251 + width: 100%;
  252 +}
  253 +
  254 +td,
  255 +th {
  256 + border: 1px solid #000;
  257 + text-align: left;
  258 + padding: 8px;
  259 +}
  260 +
  261 +tr:nth-child(even) {
  262 + background-color: #dddddd;
  263 +}
  264 +</style>
... ...
src/components/Profile.vue
... ... @@ -23,10 +23,10 @@
23 23 <div class="collapse navbar-collapse" id="navbarsExample03">
24 24 <ul class="navbar-nav mr-auto">
25 25 <li class="nav-item active">
26   - <a class="nav-link" style="cursor:pointer" @click="listPage">Case Study List</a>
  26 + <a class="nav-link" style="cursor:pointer" @click="listPage('/casestudy')">Case Study List</a>
27 27 </li>
28 28 <li class="nav-item active">
29   - <a class="nav-link" style="cursor:pointer">Create Insight</a>
  29 + <a class="nav-link" style="cursor:pointer" @click="listPage('/insight')">Create Insight</a>
30 30 </li>
31 31 </ul>
32 32 </div>
... ... @@ -330,8 +330,28 @@
330 330 >
331 331 </p>
332 332 </li>
  333 + <li class="nav-item active" v-if="slide.insight">
  334 + <div class="form-group floating-label">
  335 + <label for="lname" class="lname">Insight</label>
  336 + <select
  337 + class="form-control"
  338 + v-model="insightId"
  339 + v-on:change="insightSelected(slide)"
  340 + >
  341 + <option value="null">Select Insight</option>
  342 + <option v-for="(insight, i) in insightList" :key="i" :value="insight._id">
  343 + {{ insight._id }}
  344 + </option>
  345 + </select>
  346 + </div>
  347 + </li>
333 348 </ul>
334 349 </div>
  350 +
  351 +
  352 +
  353 +
  354 +
335 355  
336 356 <div class="row">
337 357 <div
... ... @@ -389,6 +409,7 @@
389 409 </div>
390 410 </div>
391 411 </div>
  412 +
392 413 </div>
393 414  
394 415 <!-- 1st row end -->
... ... @@ -438,6 +459,8 @@ export default {
438 459 slideId: null,
439 460 userList: [],
440 461 templateList: [],
  462 + insightList: [],
  463 + insightId:null,
441 464 caseStudy: {
442 465 caseStudyDetails: {
443 466 userId: [],
... ... @@ -485,6 +508,7 @@ export default {
485 508 this.usertoken = userdata.token;
486 509 this.getUserList();
487 510 this.getTemplateList();
  511 + this.getInsightList();
488 512 }
489 513 },
490 514 methods: {
... ... @@ -525,6 +549,14 @@ export default {
525 549 this.caseStudy.slides.push(this.templateList[i]);
526 550 console.log("this.caseStudy.slides", this.caseStudy.slides);
527 551 },
  552 + async insightSelected(data) {
  553 +
  554 + // this.caseStudy.slides.push(this.templateList[i]);
  555 +
  556 + console.log("data",data);
  557 + data.insightId = this.insightId;
  558 + this.insightId = null;
  559 + },
528 560  
529 561 removeSlide(i) {
530 562 this.caseStudy.slides.splice(i, 1);
... ... @@ -677,6 +709,20 @@ export default {
677 709 })
678 710 .catch((error) => console.log(error));
679 711 },
  712 + getInsightList() {
  713 + axios
  714 + .get("/superAdmin/insight", {
  715 + headers: {
  716 + Authorization: "Bearer " + this.usertoken,
  717 + },
  718 + })
  719 + .then((response) => {
  720 + this.insightList = response.data.data;
  721 +
  722 + console.log("insight", response.data.data);
  723 + })
  724 + .catch((error) => console.log(error));
  725 + },
680 726  
681 727 getSLideData() {
682 728 axios
... ... @@ -696,6 +742,7 @@ export default {
696 742 _id: this.templateList[i]._id,
697 743 bounceBoard: this.templateList[i].bounceBoard,
698 744 insight: this.templateList[i].insight,
  745 + slideId:template_._id,
699 746 // commentBox: this.templateList[i].commentBox,
700 747 metaData: {
701 748 fields: [],
... ... @@ -705,6 +752,9 @@ export default {
705 752 if (this.templateList[i].bounceBoard) {
706 753 obj.commentBox = this.templateList[i].commentBox;
707 754 }
  755 + if (this.templateList[i].insight) {
  756 + obj.insightId = template_.insightId;
  757 + }
708 758 var fieldArray = [];
709 759 this.templateList[i].metaData.fields.forEach((element) => {
710 760 var fieldobj = {
... ... @@ -734,6 +784,14 @@ export default {
734 784 slideData.templateId = slides._id;
735 785 slideData.bounceBoard = slides.bounceBoard;
736 786 slideData.insight = slides.insight;
  787 + if(slides.slideId){
  788 + slideData.slideId = slides.slideId;
  789 +
  790 + }
  791 + if(slides.insightId){
  792 + slideData.insightId = slides.insightId;
  793 +
  794 + }
737 795 if (slides.metaData.comments && slides.metaData.comments.length > 0) {
738 796 slideData.comments = slides.metaData.comments;
739 797 // this.getSLideData();
... ... @@ -777,6 +835,7 @@ export default {
777 835 .then((response) => {
778 836 // this.userData = response.data.data;
779 837 this.$toaster.success("Case Study Created");
  838 + this.$router.go(this.$router.currentRoute)
780 839  
781 840 console.log(response);
782 841 })
... ... @@ -814,8 +873,8 @@ export default {
814 873 }
815 874 });
816 875 },
817   - listPage(){
818   - this.$router.push("/casestudy");
  876 + listPage(url){
  877 + this.$router.push(url);
819 878 },
820 879  
821 880 async getMeatda(tempId) {
... ...
src/router/index.js
... ... @@ -4,6 +4,7 @@ import { authGuard } from &quot;../auth/authGuard&quot;
4 4 import LandingPage from '@/components/LandingPage'
5 5 import Profile from '@/components/Profile'
6 6 import CaseStudy from '@/components/CaseStudy'
  7 +import Insight from '@/components/Insight'
7 8  
8 9  
9 10 import router from '../router'
... ... @@ -32,6 +33,11 @@ export default new Router({
32 33 path: '/casestudy',
33 34 name: 'CaseStudy',
34 35 component: CaseStudy,
  36 + },
  37 + {
  38 + path: '/insight',
  39 + name: 'Insight',
  40 + component: Insight,
35 41 }
36 42  
37 43  
... ...