Skip to content

Commit

Permalink
mail field is opt, recepcionist has read only access to employees
Browse files Browse the repository at this point in the history
  • Loading branch information
cuesto committed Nov 14, 2024
1 parent 20db239 commit 012db5d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
<v-list-item-title>Visitantes</v-list-item-title>
</v-list-item>
</template>
<template v-if="isAdmin">
<template v-if="isAdmin || isRecep">
<v-list-item :to="{ name: 'employeerequests' }">
<v-list-item-action>
<v-icon>today</v-icon>
</v-list-item-action>
<v-list-item-title>Solicitudes</v-list-item-title>
</v-list-item>
</template>
<template v-if="isAdmin">
<template v-if="isAdmin || isRecep">
<v-list-item :to="{ name: 'employees' }">
<v-list-item-action>
<v-icon>people</v-icon>
Expand Down
11 changes: 8 additions & 3 deletions src/components/Employee.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<v-spacer></v-spacer>
<v-dialog v-model="dialog" persistent max-width="600px">
<template v-slot:activator="{ on }">
<v-btn color="green" dark v-on="on">
<v-btn color="green" dark v-on="on" v-if="!isRecep">
<v-icon left dark>person_add</v-icon>Nuevo Empleado
</v-btn>
</template>
Expand Down Expand Up @@ -112,7 +112,7 @@
</v-dialog>
</v-toolbar>
</template>
<template v-slot:item.options="{ item }">
<template v-slot:item.options="{ item }" v-if="!isRecep">
<v-icon
size="sm"
variant="outline-info"
Expand Down Expand Up @@ -172,7 +172,12 @@ export default {
computed: {
formTitle() {
return this.editedIndex === -1 ? "Nuevo Empleado" : "Actualizar Empleado";
}
},
isRecep() {
return (
this.$store.state.user && this.$store.state.user.role == "recepionist"
);
},
},
watch: {
Expand Down
8 changes: 2 additions & 6 deletions src/components/EmployeeRequest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
:rules="[rules.required]" prepend-icon="person_outline" dense></v-text-field>

<v-text-field v-model="employeeRequestModel.visitorEmail" label="Correo"
prepend-icon="email" :rules="[rules.email]" dense></v-text-field>
prepend-icon="email" dense></v-text-field>
</v-card>
</v-col>

Expand Down Expand Up @@ -339,11 +339,7 @@ export default {
}
],
rules: {
required: v => !!v || "Este campo es requerido",
email: v => {
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return !v || pattern.test(v) || "Correo electrónico inválido"
}
required: v => !!v || "Este campo es requerido"
},
defaultStartTime: "08:00",
defaultEndTime: "17:00",
Expand Down
6 changes: 1 addition & 5 deletions src/components/Visitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</div>
<v-row>
<v-col cols="12" md="6">
<v-text-field v-model="visitorModel.email" label="Correo electrónico" :rules="[rules.email]"
<v-text-field v-model="visitorModel.email" label="Correo electrónico"
prepend-inner-icon="email" dense></v-text-field>
</v-col>

Expand Down Expand Up @@ -246,10 +246,6 @@ export default {
mask: "(###)-###-####",
rules: {
required: value => !!value || "Requerido.",
email: value => {
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return pattern.test(value) || "Correo Inválido.";
}
},
visitorModel: new VisitorModel(),
employees: [],
Expand Down
3 changes: 2 additions & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var router = new Router({
name: "employees",
component: Employee,
meta: {
administrator: true
administrator: true,
recepionist: true
}
},
{
Expand Down

0 comments on commit 012db5d

Please sign in to comment.