versão 15h19 19/02
This commit is contained in:
parent
a8ec79861d
commit
9a925841a5
@ -179,12 +179,6 @@ export default {
|
||||
label: 'Testes',
|
||||
badge: { text: 'Dev', color: 'warning' }
|
||||
},
|
||||
{
|
||||
name: 'register-user-cam',
|
||||
route: { name: 'register-user-cam' },
|
||||
icon: 'mdi-file-document-plus',
|
||||
label: 'Registro'
|
||||
},
|
||||
{
|
||||
name: 'users',
|
||||
route: { name: 'users' },
|
||||
|
||||
@ -1,294 +0,0 @@
|
||||
<template>
|
||||
<v-container fluid>
|
||||
<v-row>
|
||||
<!-- Camera Registration -->
|
||||
<v-col cols="12" md="6">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-icon left>mdi-camera</v-icon>
|
||||
Cadastro de Câmera
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="cameraForm" v-model="cameraFormValid" lazy-validation @submit.prevent="handleCameraSubmit">
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="cameraForm.modelName"
|
||||
:rules="[v => !!v || 'Nome do modelo é obrigatório']"
|
||||
label="Nome do Modelo"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="cameraForm.id"
|
||||
:rules="[v => !!v || 'ID é obrigatório']"
|
||||
label="ID"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-text-field
|
||||
v-model="cameraForm.responsible"
|
||||
:rules="[v => !!v || 'Responsável é obrigatório']"
|
||||
label="Responsável pelo Cadastro"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-textarea
|
||||
v-model="cameraForm.description"
|
||||
:rules="[v => !!v || 'Descrição é obrigatória']"
|
||||
label="Descrição"
|
||||
required
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="cameraForm.date"
|
||||
type="date"
|
||||
:rules="[v => !!v || 'Data é obrigatória']"
|
||||
label="Data"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="cameraForm.time"
|
||||
type="time"
|
||||
:rules="[v => !!v || 'Hora é obrigatória']"
|
||||
label="Hora"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
type="submit"
|
||||
:disabled="!cameraFormValid"
|
||||
>
|
||||
Cadastrar Câmera
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<!-- Recent Cameras -->
|
||||
<v-card class="mt-4" v-if="recentCameras.length">
|
||||
<v-card-title>Últimos Cadastros de Câmeras</v-card-title>
|
||||
<v-list>
|
||||
<v-list-item
|
||||
v-for="(camera, index) in recentCameras"
|
||||
:key="index"
|
||||
>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>
|
||||
{{ camera.modelName }} - {{ camera.id }}
|
||||
</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
Responsável: {{ camera.responsible }}
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<!-- User Registration -->
|
||||
<v-col cols="12" md="6">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-icon left>mdi-account-plus</v-icon>
|
||||
Cadastro de Usuário
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="userForm" v-model="userFormValid" lazy-validation @submit.prevent="handleUserSubmit">
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-file-input
|
||||
v-model="userForm.profilePicture"
|
||||
label="Foto de Perfil"
|
||||
prepend-icon="mdi-camera"
|
||||
accept="image/*"
|
||||
@change="handleProfilePictureChange"
|
||||
></v-file-input>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.firstName"
|
||||
:rules="[v => !!v || 'Nome é obrigatório']"
|
||||
label="Nome"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.lastName"
|
||||
:rules="[v => !!v || 'Sobrenome é obrigatório']"
|
||||
label="Sobrenome"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.userId"
|
||||
:rules="[v => !!v || 'ID é obrigatório']"
|
||||
label="ID"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.email"
|
||||
:rules="[v => !!v || 'E-mail é obrigatório', v => /.+@.+\..+/.test(v) || 'E-mail inválido']"
|
||||
label="E-mail"
|
||||
type="email"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.phone"
|
||||
:rules="[v => !!v || 'Telefone é obrigatório']"
|
||||
label="Telefone"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.group"
|
||||
:rules="[v => !!v || 'Grupo é obrigatório']"
|
||||
label="Grupo"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.role"
|
||||
:rules="[v => !!v || 'Cargo é obrigatório']"
|
||||
label="Cargo"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-select
|
||||
v-model="userForm.permissions"
|
||||
:items="['Admin', 'Usuário']"
|
||||
:rules="[v => !!v || 'Permissão é obrigatória']"
|
||||
label="Permissão"
|
||||
required
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
v-model="userForm.shift"
|
||||
:rules="[v => !!v || 'Turno é obrigatório']"
|
||||
label="Turno"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
type="submit"
|
||||
:disabled="!userFormValid"
|
||||
>
|
||||
Cadastrar Usuário
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Snackbars for Feedback -->
|
||||
<v-snackbar v-model="cameraRegistered" color="success">
|
||||
Cadastro de câmera concluído!
|
||||
<template v-slot:actions>
|
||||
<v-btn text @click="cameraRegistered = false">Fechar</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
<v-snackbar v-model="userRegistered" color="success">
|
||||
Cadastro de usuário concluído!
|
||||
<template v-slot:actions>
|
||||
<v-btn text @click="userRegistered = false">Fechar</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'RegisterUserCamView',
|
||||
data() {
|
||||
return {
|
||||
cameraFormValid: false,
|
||||
userFormValid: false,
|
||||
cameraForm: {
|
||||
modelName: '',
|
||||
id: '',
|
||||
responsible: '',
|
||||
description: '',
|
||||
date: '',
|
||||
time: ''
|
||||
},
|
||||
userForm: {
|
||||
profilePicture: null,
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
userId: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
group: '',
|
||||
role: '',
|
||||
permissions: '',
|
||||
shift: ''
|
||||
},
|
||||
cameraRegistered: false,
|
||||
userRegistered: false,
|
||||
recentCameras: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleCameraSubmit() {
|
||||
if (this.$refs.cameraForm.validate()) {
|
||||
this.recentCameras.unshift({ ...this.cameraForm });
|
||||
|
||||
// Limit to 3 recent cameras
|
||||
if (this.recentCameras.length > 3) {
|
||||
this.recentCameras.pop();
|
||||
}
|
||||
|
||||
this.cameraRegistered = true;
|
||||
this.$refs.cameraForm.reset();
|
||||
}
|
||||
},
|
||||
handleUserSubmit() {
|
||||
if (this.$refs.userForm.validate()) {
|
||||
this.userRegistered = true;
|
||||
this.$refs.userForm.reset();
|
||||
}
|
||||
},
|
||||
handleProfilePictureChange(files) {
|
||||
if (files && files.length) {
|
||||
const file = files[0];
|
||||
console.log("Foto de perfil selecionada:", file.name);
|
||||
// Additional file handling logic can be added here
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.v-card {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user