Blame view

src/components/CaseStudy.vue 4.37 KB
640c12320   Digvijay Singh   update module added
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  <template>
    <main class="landing-page">
      <!-- profile -->
      <div class="container-fluid inner-wrp" style="background: transparent">
        <nav class="navbar navbar-expand-sm spotLight-nav">
          <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"
          >
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
          </button>
  
          <div class="collapse navbar-collapse" id="navbarsExample03">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
3986e5ad7   Digvijay Singh   new changes in ad...
26
                <a class="nav-link" @click="create('/profile')" style="cursor:pointer">Create Case Study</a>
640c12320   Digvijay Singh   update module added
27
28
              </li>
              <li class="nav-item active">
3986e5ad7   Digvijay Singh   new changes in ad...
29
                  <a class="nav-link" @click="create('/insight')"  style="cursor:pointer">Create Insight</a>
640c12320   Digvijay Singh   update module added
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
              </li>
            </ul>
          </div>
          <div class="">
            <a href="javascript:void(0);" @click="logout">Log Out </a>
          </div>
        </nav>
        <!-- menu wrapper -->
        <!-- <div class="row profile-tab-spc-top">
          <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>
            </div>
          </div>
        </div> -->
  
        <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" >
                    <span style="cursor:pointer"  >Case Study List</span></h5>
              </li>
            </ul>
          </div>
        </div>
        <div class="row">
          <table>
            <tr>
              <th>Name</th>
              <th>App</th>
              <th>Authors</th>
              <th>Action</th>
            </tr>
            <tr v-for="(study, j) in caseStudyList"
              :key="j"> 
              <td>{{study.intro.name}}</td>
              <td>{{study.intro.app}}</td>
              <td>{{study.intro.authors[0]}}</td>
              <td><a style="cursor:pointer" @click="edit(study)">Edit</a></td>
            </tr>
          </table>
        </div>
        <!-- 1st row -->
      </div>
    </main>
  </template>
  
  <script>
  import Vue from "vue";
  import router from "../router";
  import $ from "jquery";
  import axios from "axios";
  
  export default {
    name: "CaseStudy",
  
    data() {
      return {
        loggedinFlag: false,
        usertoken: null,
        userData: {},
        caseStudyList:[],
      };
    },
    mounted() {
    
      var userdata = localStorage.getItem("spotlight_usertoken");
      if (userdata) {
        userdata = JSON.parse(userdata);
        this.usertoken = userdata.token;
        this.getCaseSTudies();
      }
    },
    methods: {
      getCaseSTudies() {
        axios
          .get("/superAdmin/caseStudies", {
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
            this.caseStudyList = response.data.data.caseStudies;
            console.log("response", response.data.data.caseStudies);
          })
          .catch((error) => console.log(error));
      },
      edit(payload){
          console.log("study",payload)
          localStorage.setItem('spotlight_caseStudy'+payload._id, JSON.stringify(payload))
          this.$router.push("/profile?"+payload._id);
      },
3986e5ad7   Digvijay Singh   new changes in ad...
134
135
      create(url){
           this.$router.push(url);
640c12320   Digvijay Singh   update module added
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
      },
      logout(){
           this.$router.push("/");
      }
    },
  };
  </script>
  <style>
  .light-font-weight {
    font-weight: 300 !important;
  }
  
  table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
  }
  
  td,
  th {
    border: 1px solid #000;
    text-align: left;
    padding: 8px;
  }
  
  tr:nth-child(even) {
    background-color: #dddddd;
  }
  </style>