Commit d0fb3d4b authored by Reza Sahebgharan's avatar Reza Sahebgharan

feat(account-management): account-management

parent a65548d4
Pipeline #960 passed with stage
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<h5>©2005-{{ new Date().getFullYear() }} MARCO PACS</h5> <h5>©2005-{{ new Date().getFullYear() }} MARCO PACS</h5>
<v-menu transition="slide-x-transition"> <!-- <v-menu transition="slide-x-transition">
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
<v-btn <v-btn
class="changeLangBtn" class="changeLangBtn"
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<v-list-item-title>{{lng.name}}</v-list-item-title> <v-list-item-title>{{lng.name}}</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </v-menu> -->
</v-footer> </v-footer>
</template> </template>
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<v-app-bar fixed app elevation="24" color="#c0d7d6"> <v-app-bar fixed app elevation="24" color="#c0d7d6">
<v-toolbar-title class="red--text">{{$t('AppHeader.appName')}}</v-toolbar-title> <v-toolbar-title class="red--text">{{$t('AppHeader.appName')}}</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn text color="red red--text" :to="btnTo" :data-cy="btnToProp"> <!-- <v-btn text color="red red--text" :to="btnTo" :data-cy="btnToProp">
<v-icon left>{{ btnIconName }}</v-icon> <v-icon left>{{ btnIconName }}</v-icon>
<strong>{{$t(btnLabel)}}</strong> <strong>{{$t(btnLabel)}}</strong>
</v-btn> </v-btn> -->
</v-app-bar> </v-app-bar>
<!-- <v-toolbar absolute fixed app elevation="24" color="#0065613b" style="width:100%"> <!-- <v-toolbar absolute fixed app elevation="24" color="#0065613b" style="width:100%">
......
<template>
<v-container>
<v-snackbar color="primary" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar>
<v-row justify="center" dense class="flex-wrap mb-6">
<v-col md="7" lg="6" cols="12">
<v-card shaped :loading="loading">
<v-card-text>
<v-row style="margin:auto">
<v-col cols="12" class="d-flex justify-center align-center flex-wrap">
<v-list-item-avatar size="200">
<v-img v-if="!temp" :src="src"></v-img>
<v-img v-else :src="newSrc"></v-img>
<v-btn
@click="$refs.inputUpload.click()"
fab
style="position:absolute;bottom:5px;right:5px"
>
<v-icon>add_a_photo</v-icon>
</v-btn>
<input
v-show="false"
ref="inputUpload"
type="file"
@change="fileUploadFunc"
accept="image/x-png, image/gif, image/jpeg"
/>
</v-list-item-avatar>
</v-col>
</v-row>
<v-row style="margin:auto">
<v-col cols="12">
<v-text-field :label="$t('UserSetting.fullName')" v-model="fullName" />
</v-col>
<v-col cols="6">
<v-combobox
v-model="selectedLang"
:items="langList"
item-text="name"
item-value="alias"
:label="$t('UserSetting.language')"
hide-selected
persistent-hint
small-chips
clearable
dense
return-object
></v-combobox>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
rounded
color="rgb(94, 181, 177,.85)"
class="white--text"
@click="saveUserProfile"
>
<strong>{{$t("UserSetting.SaveBtn")}}</strong>
</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
<script>
import { mapActions } from "vuex";
export default {
data() {
return {
langList: [
{ name: "فارسی", alias: "fa" },
{ name: "English", alias: "en" }
],
newSelectedLang: { name: "English", alias: "en" },
loading: false,
newSrc: "/img/empty.png",
newFullName: "",
temp: false,
alertSnackbar: false,
alertText: ""
};
},
methods: {
...mapActions(["setLang"]),
alertSnackbarMethod(text) {
this.alertText = text;
this.alertSnackbar = true;
},
saveUserProfile() {
debugger;
this.loading = true;
if (this.newSelectedLang == null || this.newSelectedLang == undefined) {
this.alertSnackbarMethod(this.$t("UserSetting.chooseLanguage"));
this.loading = false;
return;
}
// this.setLang(this.newSelectedLang.alias);
let profile = {
"profile.fullName": this.newFullName,
"profile.language": this.newSelectedLang,
"profile.picture": this.newSrc
};
let me = this;
Meteor.call("editUserProfile", profile, function(err, result) {
if (result) {
me.alertSnackbarMethod(me.$t("UserSetting.successfullSave"));
}
me.temp = false;
});
this.loading = false;
},
fileUploadFunc(event) {
const file = event.target.files[0];
const reader = new FileReader();
let me = this;
reader.addEventListener(
"load",
function() {
me.temp = true;
me.src = reader.result;
},
false
);
if (file && file.type.includes("image")) {
reader.readAsDataURL(file);
} else {
this.alertSnackbarMethod(this.$t("UserSetting.chooseImage"));
}
}
},
computed: {
fullName: {
get() {
if (this.users && this.users.length > 0) {
this.newFullName = this.users[0].profile.fullName;
return this.users[0].profile.fullName;
} else {
return "";
}
},
set(newValue) {
this.newFullName = newValue;
}
},
src: {
get() {
if (this.users && this.users.length > 0) {
this.newSrc = this.users[0].profile.picture;
return this.users[0].profile.picture;
} else {
return "/img/empty.png";
}
},
set(newValue) {
this.newSrc = newValue;
}
},
selectedLang: {
get() {
debugger;
if (this.users && this.users.length > 0) {
this.newSelectedLang = this.users[0].profile.language;
return this.users[0].profile.language;
} else {
return { name: "English", alias: "en" };
}
},
set(newValue) {
this.newSelectedLang = {};
this.newSelectedLang = newValue;
}
}
},
// watch:{
// selectedLang(newLang, oldLang){
// this.setLang(newLang.alias);
// }
// }
meteor: {
$subscribe: {
users: []
},
users() {
return Meteor.users.find({ _id: Meteor.userId() }).fetch();
}
}
};
</script>
<style scoped>
</style>
\ No newline at end of file
...@@ -8,20 +8,68 @@ ...@@ -8,20 +8,68 @@
<v-snackbar color="primary" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar> <v-snackbar color="primary" v-model="alertSnackbar" :timeout="2000">{{alertText}}</v-snackbar>
<v-dialog v-model="dialog" max-width="600px"> <v-dialog v-model="dialog" max-width="600px">
<v-card> <v-card>
<v-card-title> <v-card-title v-if="newOrEdit=='new' || newOrEdit=='edit' ">
<span>{{newOrEdit=="new"?$t("Users.newText"):$t("Users.editText")}} {{$t("Users.UserName")}}</span> <span
v-if="!$vuetify.rtl"
>{{newOrEdit=="new"?$t("Users.newText"):$t("Users.editText")}} {{$t("Users.UserName")}}</span>
<template v-if="$vuetify.rtl">
<span v-if="newOrEdit=='new'">{{$t("Users.UserName")}} {{$t("Users.newText")}} </span>
<span v-if="newOrEdit=='edit'">{{$t("Users.editText")}} {{$t("Users.UserName")}}</span>
</template>
</v-card-title> </v-card-title>
<v-card-title v-if=" newOrEdit=='reset'">
<span>{{$t("Users.resetPassword")}}</span>
</v-card-title>
<v-card-text> <v-card-text>
<v-container> <v-container>
<div> <div>
<v-progress-linear :active="loading" :indeterminate="loading" color="cyan lighten-2"></v-progress-linear> <v-progress-linear :active="loading" :indeterminate="loading" color="cyan lighten-2"></v-progress-linear>
</div> </div>
<v-row dense> <v-row dense>
<v-col cols="12" md="6"> <v-col cols="12" md="6" v-if="newOrEdit=='new'">
<v-text-field label="Username" v-model="UserForm.username"></v-text-field> <v-text-field
:label="$t('Users.UsernameTxtBox')"
v-model="UserForm.username"
prepend-icon="mdi-account-circle"
:hint="this.usernameAlert?`${$t('Register.usernameAlert')}`:''"
ref="usernameTextField"
></v-text-field>
</v-col>
<v-col cols="12" md="6" v-if="newOrEdit=='new' || newOrEdit == 'edit'">
<v-text-field
:label="$t('Users.FullNameTxtBox')"
v-model="UserForm.fullName"
prepend-icon="mdi-rename-box"
ref="fullnameTextField"
></v-text-field>
</v-col> </v-col>
<v-col cols="12" md="6"> <v-col cols="12" md="6" v-if="newOrEdit=='new' || newOrEdit == 'reset'">
<v-text-field type="password" label="Password" v-model="UserForm.password"></v-text-field> <!-- <v-text-field type="password" label="Password" v-model="UserForm.password" :rules="[rules.min]"></v-text-field> -->
<v-text-field
:type="!showPassword1?'password' :'text'"
:label="$t('Register.password')"
prepend-icon="mdi-lock"
@click:append="showPassword1 = !showPassword1"
:append-icon="showPassword1 ? 'mdi-eye': 'mdi-eye-off'"
v-model="UserForm.password"
:rules="[rules.min]"
ref="firstPassTextField"
:hint="this.firstPassAlert?`${$t('Register.firstPassAlert')}`:''"
/>
</v-col>
<v-col cols="12" md="6" v-if="newOrEdit=='new' || newOrEdit == 'reset'">
<v-text-field
:type="!showPassword2?'password' :'text'"
:label="$t('Register.repeatPassword')"
prepend-icon="mdi-lock"
@click:append="showPassword2 = !showPassword2"
:append-icon="showPassword2 ? 'mdi-eye': 'mdi-eye-off'"
v-model="secondPass"
:rules="[rules.matchPass]"
ref="secondPassTextField"
:hint="this.secondPassAlert?`${$t('Register.secondPassAlert')}`:''"
/>
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
...@@ -49,6 +97,9 @@ ...@@ -49,6 +97,9 @@
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openEditDialog"> <v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openEditDialog">
<strong>{{$t("HISLink.editBtn")}}</strong> <strong>{{$t("HISLink.editBtn")}}</strong>
</v-btn> </v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="openResetDialog">
<strong>{{$t("Users.ResetPasswordBtn")}}</strong>
</v-btn>
<v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="deleteSnackbar"> <v-btn color="rgb(94, 181, 177,.85)" class="white--text" @click="deleteSnackbar">
<strong>{{$t("HISLink.deleteBtn")}}</strong> <strong>{{$t("HISLink.deleteBtn")}}</strong>
</v-btn> </v-btn>
...@@ -94,17 +145,38 @@ export default { ...@@ -94,17 +145,38 @@ export default {
UserForm: { UserForm: {
username: "", username: "",
password: "", password: "",
fullName: "",
_id: "" _id: ""
}, },
snackbar: false, snackbar: false,
alertSnackbar: false, alertSnackbar: false,
alertText: "", alertText: "",
loading: false loading: false,
rules: {
min: v => {
if (v == undefined) return true;
return v.length >= 5 || this.$t("Users.minimum5Character");
},
matchPass: v => {
return (
this.UserForm.password === this.secondPass ||
this.$t("Register.matchPass")
);
}
},
usernameAlert: false,
showPassword1: false,
firstPassAlert: false,
showPassword2: false,
secondPass: null,
secondPassAlert: false
}; };
}, },
computed: { computed: {
headerOfTable() { headerOfTable() {
let headers = ["username"]; let headers = ["username", "fullname"];
let headerObjs = []; let headerObjs = [];
for (let header of headers) { for (let header of headers) {
headerObjs.push({ headerObjs.push({
...@@ -120,7 +192,16 @@ export default { ...@@ -120,7 +192,16 @@ export default {
this.loading = false; this.loading = false;
this.dialog = false; this.dialog = false;
if (this.users && this.users.length > 0) { if (this.users && this.users.length > 0) {
return this.users; let users = [];
for (let user of this.users) {
users.push({
username: user.username,
fullname: user.profile.fullName,
_id: user._id
});
}
return users;
} }
return []; return [];
} }
...@@ -156,21 +237,139 @@ export default { ...@@ -156,21 +237,139 @@ export default {
} }
} }
this.$set(this.UserForm, "_id", this.selectedItemInTable[0]["_id"]); this.$set(this.UserForm, "_id", this.selectedItemInTable[0]["_id"]);
this.$set(
this.UserForm,
"fullName",
this.selectedItemInTable[0]["fullname"]
);
this.newOrEdit = "edit"; this.newOrEdit = "edit";
this.dialog = true; this.dialog = true;
}, },
openResetDialog() {
this.UserForm.password = "";
this.secondPass = "";
if (this.selectedItemInTable.length == 0) {
this.alertSnackbarMethod(this.$t("Users.userSelectStatement"));
return;
}
this.$set(this.UserForm, "_id", this.selectedItemInTable[0]["_id"]);
this.newOrEdit = "reset";
this.dialog = true;
},
createOrEditUser() { createOrEditUser() {
this.loading = true; this.loading = true;
let me = this; let me = this;
debugger;
if (this.newOrEdit == "new") { if (this.newOrEdit == "new") {
Meteor.call("createUser1", this.UserForm, function() { const username = this.UserForm.username;
// me.dialog = false; const password = this.UserForm.password;
}); const that = this;
if (username == null || username.length == 0) {
this.$refs.usernameTextField.focus();
this.usernameAlert = true;
this.loading = false;
return;
}
if (
this.UserForm.password == null ||
this.UserForm.password.length == 0
) {
this.$refs.firstPassTextField.focus();
this.firstPassAlert = true;
this.loading = false;
return;
}
if (this.secondPass == null || this.secondPass.length == 0) {
this.$refs.secondPassTextField.focus();
this.secondPassAlert = true;
this.loading = false;
return;
}
if (this.UserForm.password != this.secondPass) {
this.alertSnackbarMethod(this.$t("Users.matchPassword"));
this.loading = false;
return;
}
if (this.UserForm.password.length < 5) {
this.alertSnackbarMethod(this.$t("Users.minimum5Character"));
this.loading = false;
return;
}
if (this.UserForm.password == this.secondPass && username != null) {
let item = {
username: username,
password: password,
profile: {
fullName: this.UserForm.fullName,
language: { name: "English", alias: "en" },
picture: "/img/empty.png"
}
};
Meteor.call("createUser1", item, function() {
me.loading = false;
// me.dialog = false;
});
}
} }
if (this.newOrEdit == "edit") { if (this.newOrEdit == "edit") {
Meteor.call("editUser1", this.UserForm, function() { let item = {
_id: this.UserForm._id,
fullName: this.UserForm.fullName
};
Meteor.call("editUser1", item, function() {
// me.dialog = false; // me.dialog = false;
me.selectedItemInTable = []; me.selectedItemInTable = [];
me.loading = false;
});
}
if (this.newOrEdit == "reset") {
if (
this.UserForm.password == null ||
this.UserForm.password.length == 0
) {
this.$refs.firstPassTextField.focus();
this.firstPassAlert = true;
this.loading = false;
return;
}
if (this.secondPass == null || this.secondPass.length == 0) {
this.$refs.secondPassTextField.focus();
this.secondPassAlert = true;
this.loading = false;
return;
}
if (this.UserForm.password != this.secondPass) {
this.alertSnackbarMethod(this.$t("Users.matchPassword"));
this.loading = false;
return;
}
if (this.UserForm.password.length < 5) {
this.alertSnackbarMethod(this.$t("Users.minimum5Character"));
this.loading = false;
return;
}
let item = {
_id: this.UserForm._id,
password: this.UserForm.password
};
Meteor.call("setPassword", item, function() {
me.loading = false;
me.dialog = false;
// me.selectedItemInTable = [];
}); });
} }
}, },
...@@ -180,6 +379,7 @@ export default { ...@@ -180,6 +379,7 @@ export default {
this.snackbar = false; this.snackbar = false;
if (this.selectedItemInTable.length == 0) { if (this.selectedItemInTable.length == 0) {
me.alertSnackbarMethod(this.$t("Users.userSelectStatement")); me.alertSnackbarMethod(this.$t("Users.userSelectStatement"));
return; return;
} }
let deleteUser = {}; let deleteUser = {};
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>Farsi First Name:</v-card-text> >{{$t("WorkList.FarsiFirstName")}}:</v-card-text>
</v-col> </v-col>
<v-col md="3"> <v-col md="3">
<v-text-field <v-text-field
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>English First Name:</v-card-text> >{{$t("WorkList.EnglishFirstName")}}:</v-card-text>
</v-col> </v-col>
<v-col md="3"> <v-col md="3">
<v-text-field <v-text-field
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>Farsi Last Name:</v-card-text> >{{$t("WorkList.FarsiLastName")}}:</v-card-text>
</v-col> </v-col>
<v-col md="3"> <v-col md="3">
<v-text-field <v-text-field
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>English Last Name:</v-card-text> >{{$t("WorkList.EnglishLastName")}}:</v-card-text>
</v-col> </v-col>
<v-col md="3"> <v-col md="3">
<v-text-field <v-text-field
...@@ -232,14 +232,14 @@ ...@@ -232,14 +232,14 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>Farsi First Name:</v-card-text> >{{$t("WorkList.FarsiFirstName")}}:</v-card-text>
</v-col> </v-col>
<v-col sm="6" class="justify-center align-center align-self-end"> <v-col sm="6" class="justify-center align-center align-self-end">
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>English First Name:</v-card-text> >{{$t("WorkList.EnglishFirstName")}}:</v-card-text>
</v-col> </v-col>
</v-row> </v-row>
<v-row> <v-row>
...@@ -300,14 +300,14 @@ ...@@ -300,14 +300,14 @@
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>Farsi Last Name:</v-card-text> >{{$t("WorkList.FarsiLastName")}}:</v-card-text>
</v-col> </v-col>
<v-col sm="6" class="justify-center align-center align-self-end"> <v-col sm="6" class="justify-center align-center align-self-end">
<v-card-text <v-card-text
class="subtitle-1 font-weight-bold black--text" class="subtitle-1 font-weight-bold black--text"
style="text-align:center" style="text-align:center"
>English Last Name:</v-card-text> >{{$t("WorkList.EnglishLastName")}}:</v-card-text>
</v-col> </v-col>
</v-row> </v-row>
<v-row> <v-row>
......
...@@ -71,7 +71,11 @@ const messages = { ...@@ -71,7 +71,11 @@ const messages = {
Register: "Register", Register: "Register",
CreatePatient: "Create", CreatePatient: "Create",
RegisterPatient: "Register Patient", RegisterPatient: "Register Patient",
EditRegisterPatient: "Edit Patient Information" EditRegisterPatient: "Edit Patient Information",
FarsiFirstName: "Farsi First Name",
EnglishFirstName: "English First Name",
FarsiLastName: "Farsi Last Name",
EnglishLastName: "English Last Name"
}, },
HISLink: { HISLink: {
DeleteMessage: "Are You Sure?", DeleteMessage: "Are You Sure?",
...@@ -127,12 +131,27 @@ const messages = { ...@@ -127,12 +131,27 @@ const messages = {
editText: "Edit", editText: "Edit",
UserName: "Users", UserName: "Users",
createBtn: "Create", createBtn: "Create",
resetPassword: "Reset Password",
editBtn: "Edit", editBtn: "Edit",
userSelectStatement: "please select one of users", userSelectStatement: "please select one of users",
userDeleteStatement: "user has been deleted", userDeleteStatement: "user has been deleted",
UsernameTxtBox: "Username",
FullNameTxtBox: "Fullname",
ResetPasswordBtn: "Reset Password",
matchPassword: "password and its repeat must be the same",
minimum5Character: "minimum 5 characters required"
}, },
HisWorklist: { HisWorklist: {
title: "Worklist" title: "Worklist"
},
UserSetting: {
language: "Language",
fullName: "Full Name",
SaveBtn: "Save",
chooseLanguage: "please choose a language",
successfullSave: "changes have been successfully saved",
chooseImage: "please choose an image"
} }
}, },
'fa': { 'fa': {
...@@ -203,7 +222,11 @@ const messages = { ...@@ -203,7 +222,11 @@ const messages = {
Register: "ثبت", Register: "ثبت",
CreatePatient: "ایجاد", CreatePatient: "ایجاد",
RegisterPatient: "ایجاد بیمار", RegisterPatient: "ایجاد بیمار",
EditRegisterPatient: "ویرایش اطلاعات بیمار" EditRegisterPatient: "ویرایش اطلاعات بیمار",
FarsiFirstName: "نام به فارسی",
EnglishFirstName: "نام به انگلیسی",
FarsiLastName: "نام خانوادگی به فارسی",
EnglishLastName: "نام خانوادگی به انگلیسی"
}, },
HISLink: { HISLink: {
...@@ -258,14 +281,30 @@ const messages = { ...@@ -258,14 +281,30 @@ const messages = {
NoBtn: "نه", NoBtn: "نه",
newText: "جدید", newText: "جدید",
editText: "ویرایش", editText: "ویرایش",
resetPassword: "تغییر رمز کاربر",
UserName: "کاربر", UserName: "کاربر",
createBtn: "ایجاد", createBtn: "ایجاد",
editBtn: "ویرایش", editBtn: "ویرایش",
userSelectStatement: "لطفا یکی از کاربر ها را انتخاب نمایید", userSelectStatement: "لطفا یکی از کاربر ها را انتخاب نمایید",
userDeleteStatement: "کاربر حذف گردید", userDeleteStatement: "کاربر حذف گردید",
UsernameTxtBox: "نام کاربری",
FullNameTxtBox: "نام و نام خانوادگی",
ResetPasswordBtn: "تغییر رمز",
matchPassword: "رمز و تکرار آن می بایست یکی باشد",
minimum5Character: "رمز باید حداقل دارای 5 کاراکتر باشد"
}, },
HisWorklist: { HisWorklist: {
title: "لیست بیماران" title: "لیست بیماران"
},
UserSetting: {
language: "زبان",
fullName: "نام خانوادگی",
SaveBtn: "ذخیره",
chooseLanguage: "لطفا یک زبان را انتخاب نمایید",
successfullSave: "اطلاعات با موفقیت ذخیره گردید",
chooseImage: "لطفا یک عکس انتخاب نمایید"
} }
} }
......
...@@ -94,18 +94,19 @@ ...@@ -94,18 +94,19 @@
import Login from '../views/Login.vue'; import Login from '../views/Login.vue';
import Home from '../views/Home.vue'; import Home from '../views/Home.vue';
import Register from '../views/Register.vue'; // import Register from '../views/Register.vue';
import ChangePassword from '../views/ChangePassword.vue'; import ChangePassword from '../views/ChangePassword.vue';
import Main from '../views/Main.vue'; import Main from '../views/Main.vue';
import EditWorkList from '../components/EditWorkList.vue'; import EditWorkList from '../components/EditWorkList.vue';
import RegisterPatient from '../components/RegisterPatient.vue'; import RegisterPatient from '../components/RegisterPatient.vue';
import WorkList from '../components/Worklist.vue'; // import WorkList from '../components/Worklist.vue';
import HisLink from '../components/HisLink.vue'; // import HisLink from '../components/HisLink.vue';
import DeviceMap from '../components/DeviceMap.vue'; import DeviceMap from '../components/DeviceMap.vue';
import Client from '../components/Client.vue'; import Client from '../components/Client.vue';
import Users from '../components/Users.vue'; import Users from '../components/Users.vue';
import UserSetting from '../components/UserSetting.vue';
import AppVersion from '../views/AppVersion.vue'; import AppVersion from '../views/AppVersion.vue';
...@@ -124,11 +125,11 @@ const routes = [{ ...@@ -124,11 +125,11 @@ const routes = [{
component: Login, component: Login,
name: 'signin' name: 'signin'
}, },
{ // {
path: '/signup', // path: '/signup',
component: Register, // component: Register,
name: 'signup' // name: 'signup'
}, // },
{ {
path: '/changePassword', path: '/changePassword',
component: ChangePassword, component: ChangePassword,
...@@ -141,14 +142,18 @@ const routes = [{ ...@@ -141,14 +142,18 @@ const routes = [{
path: "worklist", path: "worklist",
name: "worklist", name: "worklist",
components: { components: {
default: WorkList, // default: WorkList,
default: () =>
import ('../components/Worklist.vue'),
register_patient: RegisterPatient register_patient: RegisterPatient
// edit_worklist: WorkList // edit_worklist: WorkList
} }
}, { }, {
path: "hislink", path: "hislink",
name: "hislink", name: "hislink",
component: HisLink // component: HisLink
component: () =>
import ('../components/HisLink.vue')
}, { }, {
path: "devicemap", path: "devicemap",
name: "devicemap", name: "devicemap",
...@@ -161,6 +166,10 @@ const routes = [{ ...@@ -161,6 +166,10 @@ const routes = [{
path: "users", path: "users",
name: "users", name: "users",
component: Users component: Users
}, {
path: "usersetting",
name: "usersetting",
component: UserSetting
}] }]
} }
]; ];
......
...@@ -5,11 +5,59 @@ ...@@ -5,11 +5,59 @@
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon> <v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title class="red--text">Karname</v-toolbar-title> <v-toolbar-title class="red--text">Karname</v-toolbar-title>
<router-view name="register_patient"></router-view> <router-view name="register_patient"></router-view>
<v-spacer></v-spacer> <v-spacer></v-spacer>
</v-app-bar> </v-app-bar>
<v-navigation-drawer v-model="drawer" app clipped> <v-navigation-drawer v-model="drawer" app clipped>
<v-system-bar></v-system-bar>
<v-list nav dense> <v-list nav dense>
<v-list-item>
<v-list-item-avatar size="100">
<v-img :src="src"></v-img>
<!-- <v-btn x-small fab style="position:absolute;bottom:0;right:0">
<v-icon small>add_a_photo</v-icon>
</v-btn>-->
</v-list-item-avatar>
</v-list-item>
<v-list-group no-action>
<template v-slot:activator>
<v-list-item-content>
<v-list-item-title class="pa-2">{{fullName}}</v-list-item-title>
<!-- <v-list-item-subtitle></v-list-item-subtitle> -->
</v-list-item-content>
</template>
<v-list-item class="pl-10" to="/main/usersetting">
<v-list-item-icon>
<v-icon>settings_applications</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Setting</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item class="pl-10" @click="logoffUser">
<v-list-item-icon>
<v-icon>exit_to_app</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Signout</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-group>
<!-- <v-list-item link>
<v-list-item-content>
<v-list-item-title class="title">John Leider</v-list-item-title>
<v-list-item-subtitle>john@vuetifyjs.com</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-icon>mdi-menu-down</v-icon>
</v-list-item-action>
</v-list-item>-->
<v-divider></v-divider>
<v-list-item-group v-model="item" color="primary"> <v-list-item-group v-model="item" color="primary">
<v-list-item v-for="(item, i) in updatedItems" :key="i" :to="item.url"> <v-list-item v-for="(item, i) in updatedItems" :key="i" :to="item.url">
<!-- <v-list-item-icon> <!-- <v-list-item-icon>
...@@ -26,15 +74,47 @@ ...@@ -26,15 +74,47 @@
<template v-if="$vuetify.rtl"> <template v-if="$vuetify.rtl">
<v-app-bar app clipped-right color="teal lighten-3" dark> <v-app-bar app clipped-right color="teal lighten-3" dark>
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon> <v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title class="red--text">Karname</v-toolbar-title> <v-toolbar-title class="red--text">Karname</v-toolbar-title>
<router-view name="register_patient"></router-view> <router-view name="register_patient"></router-view>
<v-spacer></v-spacer> <v-spacer></v-spacer>
</v-app-bar> </v-app-bar>
<v-navigation-drawer v-model="drawer" app clipped right> <v-navigation-drawer v-model="drawer" app clipped right>
<v-system-bar></v-system-bar>
<v-list nav dense> <v-list nav dense>
<v-list-item>
<v-list-item-avatar size="100">
<v-img :src="src"></v-img>
<!-- <v-btn x-small fab style="position:absolute;bottom:0;left:0">
<v-icon small>add_a_photo</v-icon>
</v-btn>-->
</v-list-item-avatar>
</v-list-item>
<v-list-group no-action>
<template v-slot:activator>
<v-list-item-content>
<v-list-item-title class="pa-2">{{fullName}}</v-list-item-title>
</v-list-item-content>
</template>
<v-list-item class="pr-10" to="/main/usersetting">
<v-list-item-icon>
<v-icon>settings_applications</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Setting</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item class="pr-10" @click="logoffUser">
<v-list-item-icon>
<v-icon>exit_to_app</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Signout</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-group>
<v-divider></v-divider>
<v-list-item-group v-model="item" color="primary"> <v-list-item-group v-model="item" color="primary">
<v-list-item v-for="(item, i) in updatedItems" :key="i" :to="item.url"> <v-list-item v-for="(item, i) in updatedItems" :key="i" :to="item.url">
<!-- <v-list-item-icon> <!-- <v-list-item-icon>
...@@ -57,7 +137,7 @@ ...@@ -57,7 +137,7 @@
<keep-alive> <keep-alive>
<router-view name="edit_worklist"></router-view> <router-view name="edit_worklist"></router-view>
</keep-alive> </keep-alive>
</transition> --> </transition>-->
</v-content> </v-content>
<app-footer></app-footer> <app-footer></app-footer>
...@@ -69,6 +149,7 @@ import { Fragment } from "vue-fragment"; ...@@ -69,6 +149,7 @@ import { Fragment } from "vue-fragment";
import AppFooter from "../components/AppFooter.vue"; import AppFooter from "../components/AppFooter.vue";
import { Meteor } from "meteor/meteor"; import { Meteor } from "meteor/meteor";
import RegisterPatient from "../components/RegisterPatient.vue"; import RegisterPatient from "../components/RegisterPatient.vue";
import { mapActions } from "vuex";
export default { export default {
components: { components: {
"app-footer": AppFooter, "app-footer": AppFooter,
...@@ -78,14 +159,19 @@ export default { ...@@ -78,14 +159,19 @@ export default {
props: { props: {
source: String source: String
}, },
methods:{ methods: {
...mapActions(["setLang"]),
logoffUser() {
Meteor.logout();
this.$router.push({ path: "/signin" });
document.location.reload();
}
}, },
computed: { computed: {
// getCurrentRoute(){ // getCurrentRoute(){
// debugger // debugger
// return this.$router.currentRoute.name == "worklist" // return this.$router.currentRoute.name == "worklist"
// }, // },
updatedItems() { updatedItems() {
if ( if (
...@@ -95,8 +181,52 @@ export default { ...@@ -95,8 +181,52 @@ export default {
) { ) {
if (this.items.findIndex(item => item.text == "Users") < 0) if (this.items.findIndex(item => item.text == "Users") < 0)
this.items.push({ text: "Users", url: "/main/users" }); this.items.push({ text: "Users", url: "/main/users" });
} else {
const index = this.items.indexOf("Users");
if (index > -1) {
this.items.splice(index, 1);
}
} }
return this.items; return this.items;
},
fullName: {
get() {
if (this.users && this.users.length > 0) {
this.setLang(this.users[0].profile.language.alias);
return this.users[0].profile.fullName;
} else {
return "";
}
},
set(newValue) {
// this.newFullName = newValue;
}
},
src: {
get() {
if (this.users && this.users.length > 0) {
return this.users[0].profile.picture;
} else {
return "/img/empty.png";
}
},
set(newValue) {
// this.newSrc = newValue;
}
},
selectedLang: {
get() {
debugger;
if (this.users && this.users.length > 0) {
return this.users[0].profile.language;
} else {
return { name: "English", alias: "en" };
}
},
set(newValue) {
// this.newSelectedLang = {};
// this.newSelectedLang = newValue;
}
} }
}, },
data: () => ({ data: () => ({
...@@ -117,7 +247,7 @@ export default { ...@@ -117,7 +247,7 @@ export default {
users: [] users: []
}, },
users() { users() {
return Meteor.users.find({}); return Meteor.users.find({ _id: Meteor.userId() });
} }
} }
}; };
......
...@@ -14,8 +14,12 @@ Meteor.methods({ ...@@ -14,8 +14,12 @@ Meteor.methods({
let userExists = Meteor.users.findOne({ username: item.username }); let userExists = Meteor.users.findOne({ username: item.username });
if (userExists == undefined || userExists == null) if (userExists == undefined || userExists == null)
Accounts.createUser({ Accounts.createUser({
username: item.username, ...item
password: item.password // username: item.username,
// password: item.password,
// profile:{
// }
}); });
return true return true
...@@ -27,6 +31,21 @@ Meteor.methods({ ...@@ -27,6 +31,21 @@ Meteor.methods({
} }
}, },
"editUser1" (item) { "editUser1" (item) {
this.unblock();
if (this.userId) {
try {
debugger;
Meteor.users.update({ _id: item._id }, { $set: { "profile.fullName": item.fullName } }, { upsert: true })
// Accounts.setPassword(item._id, item.password, { logout: true })
return true
} catch (e) {
// Got a network error, timeout, or HTTP error in the 400 or 500 range.
console.log(e);
return false;
}
}
},
"setPassword" (item) {
this.unblock(); this.unblock();
if (this.userId) { if (this.userId) {
try { try {
...@@ -55,4 +74,20 @@ Meteor.methods({ ...@@ -55,4 +74,20 @@ Meteor.methods({
} }
} }
}, },
"editUserProfile" (item) {
debugger;
this.unblock();
if (this.userId) {
try {
debugger;
// db.collection.update( { _id:...} , { $set: { some_key.param2 : new_info } }
Meteor.users.update({ _id: this.userId }, { $set: {...item } }, { upsert: true })
return true
} catch (e) {
// Got a network error, timeout, or HTTP error in the 400 or 500 range.
console.log(e);
return false;
}
}
}
}); });
\ No newline at end of file
...@@ -9,13 +9,22 @@ Meteor.publish("users", function() { ...@@ -9,13 +9,22 @@ Meteor.publish("users", function() {
if (this.userId) { if (this.userId) {
let isMarcoAdmin = Meteor.users.findOne({ _id: this.userId }); let isMarcoAdmin = Meteor.users.findOne({ _id: this.userId });
if (isMarcoAdmin.username == "marcoadmin") { if (isMarcoAdmin.username == "marcoadmin") {
return Meteor.users.find({ username: { $ne: "marcoadmin" } }, {
return Meteor.users.find({ username: { $ne: "marcoadmin" } }); disableOplog: true,
// pollingThrottleMs: 1000,
pollingIntervalMs: 1000
});
} }
// return Meteor.users.find({}); // return Meteor.users.find({});
else else
return []; return Meteor.users.find({ _id: this.userId }, {
disableOplog: true,
// pollingThrottleMs: 1000,
pollingIntervalMs: 1000
});
// return Clients.find({}, { // return Clients.find({}, {
// reactive: true, // reactive: true,
......
...@@ -29,5 +29,5 @@ Meteor.startup(() => { ...@@ -29,5 +29,5 @@ Meteor.startup(() => {
password: 'sysAdmin4.21' password: 'sysAdmin4.21'
}); });
Meteor.users.deny({ update: () => true });
}); });
\ No newline at end of file
{ {
"worklistUrl": "http://karname-broker.karname.ir", "worklistUrl": "http://192.168.0.66:8086",
"databusUrl": "http://localhost:8090" "databusUrl": "http://localhost:8090"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment