Merge branch 'migrate-alex' into 'master'
add: form edit profile See merge request jcruzbaasworkspace/enruta/webeta!8
This commit is contained in:
97
src/components/EditProfileModal.vue
Normal file
97
src/components/EditProfileModal.vue
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useAuthStore } from '../stores/auth';
|
||||||
|
import Spiner from './ui/Spiner.vue';
|
||||||
|
import CustomInput from './ui/CustomInput.vue';
|
||||||
|
|
||||||
|
const auth = useAuthStore();
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const user = reactive({
|
||||||
|
// name: '',
|
||||||
|
// lastName: '',
|
||||||
|
// phone1: '',
|
||||||
|
// phone2: '',
|
||||||
|
name: auth.user?.first_name,
|
||||||
|
lastName: auth.user?.last_name,
|
||||||
|
phone1: auth.user?.phone,
|
||||||
|
phone2: auth.user?.phone2,
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
user.name = auth.user?.first_name
|
||||||
|
user.lastName = auth.user?.last_name
|
||||||
|
user.phone1 = auth.user?.phone
|
||||||
|
user.phone2 = auth.user?.phone2
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="modal fade" id="editProfileModal" tabindex="-1" role="dialog" aria-labelledby="editProfileModal" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 class="title mt-2 mb-3">Editar perfil</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close bg-white"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body form-content">
|
||||||
|
<form @submit.prevent="handleSave" autocomplete="off" method="post" ref="formRef">
|
||||||
|
<CustomInput
|
||||||
|
label="Nombres(s):"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.name"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Apellidos(s):"
|
||||||
|
type="text"
|
||||||
|
name="lastname"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.lastName"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Teléfono 1: *"
|
||||||
|
type="number"
|
||||||
|
name="phone1"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.phone1"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Teléfono 2:"
|
||||||
|
type="number"
|
||||||
|
name="phone2"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.phone2"
|
||||||
|
/>
|
||||||
|
<div class="mt-4 text-center">
|
||||||
|
<Spiner v-if="loading"/>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-dark" type="submit">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
comments: '',
|
comments: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { geocodeAddress, getDirections } = useDirectionsRender()
|
const { getDirections } = useDirectionsRender()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
load: {
|
load: {
|
||||||
|
|||||||
@@ -1,18 +1,63 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useAuthStore } from '../stores/auth';
|
||||||
import { useNotificationsStore } from '../stores/notifications';
|
import { useNotificationsStore } from '../stores/notifications';
|
||||||
|
|
||||||
const noty = useNotificationsStore();
|
const noty = useNotificationsStore();
|
||||||
|
const auth = useAuthStore();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const closePopup = () => {
|
||||||
|
noty.toggleProfile()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEditProfile = () => {
|
||||||
|
closePopup();
|
||||||
|
router.push({name: 'profile'})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="noty.openProfile"
|
v-if="noty.openProfile"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="content-profile"
|
||||||
|
@click="closePopup()"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
class="profile-card">
|
class="profile-card">
|
||||||
<p>Hola</p>
|
<i class="fa-solid fa-xmark close-icon" @click="closePopup()"></i>
|
||||||
|
<h3>{{auth.user?.first_name}} {{ auth.user?.last_name }}</h3>
|
||||||
|
<p>{{ auth.user?.email }}</p>
|
||||||
|
<p>{{ auth.user?.phone }}</p>
|
||||||
|
<br/>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#editProfileModal"
|
||||||
|
@click="handleEditProfile()"
|
||||||
|
>Editar perfil</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
.content-profile {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1000;
|
||||||
|
width: 100wv;
|
||||||
|
right: 0px;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
cursor: pointer;
|
||||||
|
bottom: 0px;
|
||||||
|
background-color: #000;
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
.profile-card {
|
.profile-card {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 20px;
|
right: 20px;
|
||||||
@@ -20,9 +65,36 @@ import { useNotificationsStore } from '../stores/notifications';
|
|||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
|
opacity: 1;
|
||||||
border-radius: 13px;
|
border-radius: 13px;
|
||||||
height: 400px;
|
padding: 20px 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
/* flex-wrap: nowrap; */
|
||||||
|
/* overflow: hidden; */
|
||||||
|
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.10));
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card h3 {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card p {
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-icon {
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
right: 20px;
|
||||||
|
top: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import NavBar from '../components/NavBar.vue';
|
import NavBar from '../components/NavBar.vue';
|
||||||
import Sidebar from '../components/Sidebar.vue';
|
import Sidebar from '../components/Sidebar.vue';
|
||||||
import ProfilePopup from '../components/ProfilePopup.vue';
|
import ProfilePopup from '../components/ProfilePopup.vue';
|
||||||
|
import EditProfileModal from '../components/EditProfileModal.vue';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ const router = createRouter({
|
|||||||
name: 'company',
|
name: 'company',
|
||||||
component: () => import('../views/MyCompanyView.vue'),
|
component: () => import('../views/MyCompanyView.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'profile',
|
||||||
|
name: 'profile',
|
||||||
|
component: () => import('../views/EditProfileView.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'empresa/:id',
|
path: 'empresa/:id',
|
||||||
name: 'public-users',
|
name: 'public-users',
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const toggleProfile = () => {
|
const toggleProfile = () => {
|
||||||
console.log('click');
|
|
||||||
openProfile.value = !openProfile.value;
|
openProfile.value = !openProfile.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +29,6 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
|||||||
error,
|
error,
|
||||||
show,
|
show,
|
||||||
openProfile,
|
openProfile,
|
||||||
toggleProfile
|
toggleProfile,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
117
src/views/EditProfileView.vue
Normal file
117
src/views/EditProfileView.vue
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useAuthStore } from '../stores/auth';
|
||||||
|
import Spiner from '../components/ui/Spiner.vue';
|
||||||
|
import CustomInput from '../components/ui/CustomInput.vue';
|
||||||
|
|
||||||
|
const auth = useAuthStore();
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const user = reactive({
|
||||||
|
name: '',
|
||||||
|
lastName: '',
|
||||||
|
phone1: '',
|
||||||
|
phone2: '',
|
||||||
|
// name: auth.user?.first_name,
|
||||||
|
// lastName: auth.user?.last_name,
|
||||||
|
// phone1: auth.user?.phone,
|
||||||
|
// phone2: auth.user?.phone2,
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
user.name = auth.user?.first_name
|
||||||
|
user.lastName = auth.user?.last_name
|
||||||
|
user.phone1 = auth.user?.phone
|
||||||
|
user.phone2 = auth.user?.phone2
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="form-content">
|
||||||
|
<form @submit.prevent="handleSave" autocomplete="off" method="post" ref="formRef">
|
||||||
|
<CustomInput
|
||||||
|
label="Nombres(s):"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.name"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Apellidos(s):"
|
||||||
|
type="text"
|
||||||
|
name="lastname"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.lastName"
|
||||||
|
/>
|
||||||
|
<div class="content-phone">
|
||||||
|
<CustomInput
|
||||||
|
label="Teléfono 1: *"
|
||||||
|
type="number"
|
||||||
|
name="phone1"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.phone1"
|
||||||
|
/>
|
||||||
|
<CustomInput
|
||||||
|
label="Teléfono 2:"
|
||||||
|
type="number"
|
||||||
|
name="phone2"
|
||||||
|
:step="1"
|
||||||
|
:filled="false"
|
||||||
|
v-model:field="user.phone2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 text-center">
|
||||||
|
<Spiner v-if="loading"/>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn btn-dark" type="submit">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 100px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 32px 32px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-phone{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
/* gap: 5rem; */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 16px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 32px 32px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 568px) {
|
||||||
|
.form-content {
|
||||||
|
margin: 24px 8px;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 20px 20px;
|
||||||
|
border-radius: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-phone{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
const mapKey = import.meta.env.VITE_MAP_KEY;
|
const mapKey = import.meta.env.VITE_MAP_KEY;
|
||||||
|
|
||||||
const { geocodeAddress, getDirections } = useDirectionsRender()
|
const { getDirections } = useDirectionsRender()
|
||||||
const { getLoadTracking, load, loading } = useTrackingLoad();
|
const { getLoadTracking, load, loading } = useTrackingLoad();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const zoom = ref(6);
|
const zoom = ref(6);
|
||||||
|
|||||||
Reference in New Issue
Block a user