MyProfile.vue 5.03 KB
Newer Older
Quentin David's avatar
Quentin David committed
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
26
27
28
29
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
134
135
136
137
138
139
140
141
142
143
144
<template>
  <v-container class="my-5">
    <v-card outlined class="my-5 px-6">
      <v-card-title class="justify-center py-6">
        <h1 class="display-3">Mon profil</h1>
      </v-card-title>
        <v-row justify="center">
            <v-col cols="5">
                <v-row dense>
                    <v-col cols="7">
                        <v-text-field
                            dense
                            filled
                            prepend-icon="fa-at"
                            :disabled="!modify_mail"
                            v-model="my_mail"
                        ></v-text-field>
                    </v-col>
                    <v-col cols="4" class="ml-5">
                        <v-btn 
                            v-if="!modify_mail"
                            @click="modify_mail = !modify_mail"
                        >Modifier</v-btn>
                        <v-btn 
                            v-else
                            color="success"
                            @click="validate_mail()"
                        >
                            Valider
                        </v-btn>
                    </v-col>
                </v-row>
                <v-row dense class="align-center mb-5">
                    <v-col cols="7" align="left">
                        <div>
                        <v-icon class="mr-6">fa-unlock-alt</v-icon>
                        Mot de passe</div>
                    </v-col>
                    <v-col cols="4" class="ml-5">
                        <v-btn @click="modify_pass = !modify_pass">
                            Modifier
                        </v-btn>
                    </v-col>
                </v-row>
                <template v-if="modify_pass">
                    <v-form class="ml-0">
                        <v-text-field
                        dense
                        filled
                        label="Ancien mdp"
                        class="small"
                        hide-details
                        />
                        <v-text-field
                        dense
                        filled
                        label="Nouveau mdp"
                        class="small"
                        hide-details="auto"
                        />
                        <v-text-field
                        dense
                        label="Répétez votre nouveau mdp"
                        class="small"
                        filled
                        hide-details="auto"
                        />
                    </v-form>
                    <v-btn 
                      class="mt-3 mb-5" 
                      width="250px" 
                      color="success" 
                      @click="validate_password">Valider</v-btn>
                </template>
                <v-divider/>
                <v-switch 
                inset 
                v-model="should_automail" 
                label="Envoyer un mail automatiquement lors de la complétion d'un traitement.">
                </v-switch>
            </v-col>
            <v-divider vertical/>
            <v-col cols="5">
                <v-row justify="center">
                    <v-col cols="6">
                        <v-hover v-slot:default="{ hover }">
                            <v-card outlined to="/user/list" :elevation="hover ? 12 : 2">
                                <v-card-title class="text-center">
                                    Mes traitements
                                </v-card-title>
                            </v-card>
                        </v-hover>
                    </v-col>
                    <v-col cols="6">
                        <v-hover v-slot:default="{ hover }">
                            <v-card outlined to="/user/corpus" :elevation="hover ? 12 : 2">
                                <v-card-title>
                                    Mes corpus
                                </v-card-title>
                            </v-card>
                        </v-hover>
                    </v-col>
                </v-row>
            </v-col>
        </v-row>
    </v-card>
  </v-container>
</template>
<script>
export default {
    data: () =>({
        my_mail: "gg@prune.fr",
        modify_mail: false,
        modify_pass: false,
        should_automail: true, // Should get value from DB
    }),
    methods: {
        validate_mail: function () {
            console.log("New value for mail:")
            console.log(this.my_mail);
            // Verify that the new mail is valid (regex)
            var validation = true;
            if (validation) {
                this.modify_mail = !this.modify_mail;
                // Send new mail to DB
            }
        },
        validate_password: function() {
            // Verify that the new password is valid
            var validation = true;
            if (validation) {
                this.modify_pass = false;
                // Update new pwd
            }
        }
    }
}
</script>
<style>
  .small {
      width: 250px;
      margin: 0px 0px 5px !important
  }
</style>