ancora parte 3
This commit is contained in:
@@ -194,6 +194,7 @@ export const shared_consts = {
|
||||
PAGERIS: 1620,
|
||||
CMYCIRCUITS: 1630,
|
||||
CREA_VOLANTINO: 1700,
|
||||
VIAGGI_WIDGET: 1720,
|
||||
},
|
||||
|
||||
QUERYTYPE_MYGROUP: 1,
|
||||
@@ -2058,6 +2059,11 @@ export const shared_consts = {
|
||||
label: 'Genera Volantini',
|
||||
icon: 'fas fa-user-tie',
|
||||
},
|
||||
{
|
||||
value: 1720, // VIAGGI_WIDGET
|
||||
label: 'Widget Viaggi',
|
||||
icon: 'fas fa-car-side',
|
||||
},
|
||||
{
|
||||
value: 120,
|
||||
label: 'OpenStreetMap',
|
||||
|
||||
@@ -33,6 +33,7 @@ import { LandingFooter } from '@/components/LandingFooter';
|
||||
import { CMyActivities } from '@/components/CMyActivities';
|
||||
import { CECommerce } from '@/components/CECommerce';
|
||||
import { EventPosterGenerator } from '@/components/EventPosterGenerator';
|
||||
import { RideWidget } from 'app/src/modules/viaggi/components/widgets/RideWidget';
|
||||
import { CheckEmail } from '@/components/CheckEmail';
|
||||
import { HomeRiso } from '@/components/HomeRiso';
|
||||
import mycircuits from '@/views/user/mycircuits/mycircuits.vue';
|
||||
@@ -123,6 +124,7 @@ export default defineComponent({
|
||||
CStatusReg,
|
||||
CDashboard,
|
||||
CheckEmail,
|
||||
RideWidget,
|
||||
CMainView,
|
||||
CNotifAtTop,
|
||||
CPresentazione,
|
||||
|
||||
@@ -154,6 +154,20 @@
|
||||
|
||||
<EventPosterGenerator></EventPosterGenerator>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="myel.type === shared_consts.ELEMTYPE.VIAGGI_WIDGET"
|
||||
class="myElemBase"
|
||||
>
|
||||
˚
|
||||
<div
|
||||
v-if="editOn"
|
||||
class="elemEdit"
|
||||
>
|
||||
VIAGGI
|
||||
</div>
|
||||
|
||||
<RideWidget></RideWidget>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="myel.type === shared_consts.ELEMTYPE.IMGPOSTER"
|
||||
class="myElemBase"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { defineComponent, ref, computed, onMounted, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { Api } from '@api';
|
||||
import type { Ride, ContribType } from '../../types/viaggi.types';
|
||||
import type { Ride, ContribType } from '../../../types/viaggi.types';
|
||||
|
||||
interface WidgetStats {
|
||||
offers: number;
|
||||
@@ -0,0 +1 @@
|
||||
export { default as RideWidget } from './RideWidget.vue';
|
||||
@@ -158,7 +158,7 @@ export function useChat() {
|
||||
}
|
||||
}
|
||||
|
||||
return response.data;
|
||||
return response;
|
||||
} catch (err: any) {
|
||||
error.value = err.message || 'Errore nella creazione della chat';
|
||||
throw err;
|
||||
|
||||
@@ -313,7 +313,7 @@ export function useRides() {
|
||||
/**
|
||||
* Completa viaggio
|
||||
*/
|
||||
const completeRide = async (rideId: string) => {
|
||||
const completeRideApi = async (rideId: string) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
@@ -567,7 +567,7 @@ export function useRides() {
|
||||
createRide,
|
||||
updateRide,
|
||||
deleteRide,
|
||||
completeRide,
|
||||
completeRideApi,
|
||||
fetchMyRides,
|
||||
fetchStats,
|
||||
|
||||
|
||||
@@ -350,13 +350,13 @@ export default defineComponent({
|
||||
// ✅ Added: Start chat with user
|
||||
const startChatWith = async (user: User) => {
|
||||
try {
|
||||
const chat = await getOrCreateDirectChat(user._id);
|
||||
const response = await getOrCreateDirectChat(user._id);
|
||||
showUserSearch.value = false;
|
||||
userSearchQuery.value = '';
|
||||
searchedUsers.value = [];
|
||||
|
||||
if (chat) {
|
||||
router.push(`/viaggi/chat/${chat._id}`);
|
||||
if (response?.data) {
|
||||
router.push(`/viaggi/chat/${response.data._id}`);
|
||||
}
|
||||
} catch (error) {
|
||||
$q.notify({
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useChat } from '../composables/useChat';
|
||||
import RideCard from '../components/ride/RideCard.vue';
|
||||
import FeedbackList from '../components/feedback/FeedbackList.vue';
|
||||
import type { DriverPublicProfile } from '../types';
|
||||
import { useUserStore } from 'app/src/store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DriverProfilePage',
|
||||
@@ -33,10 +34,11 @@ export default defineComponent({
|
||||
|
||||
// Refs
|
||||
const ridesSection = ref<HTMLElement | null>(null);
|
||||
const currentUserId = ref(''); // TODO: Get from auth
|
||||
const userStore = useUserStore()
|
||||
const currentUserId = ref<string>(userStore.my._id);
|
||||
|
||||
// Computed
|
||||
const userId = computed(() => route.params.id as string);
|
||||
const userId = computed(() => route.params.id ? route.params.id.toString() : currentUserId.value);
|
||||
|
||||
const isOwnProfile = computed(() => userId.value === currentUserId.value);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export default defineComponent({
|
||||
loading,
|
||||
fetchMyRides,
|
||||
deleteRide,
|
||||
completeRide: completeRideApi
|
||||
completeRideApi,
|
||||
} = useRides();
|
||||
|
||||
const {
|
||||
@@ -159,10 +159,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
const openFeedbackDialog = (ride: Ride) => {
|
||||
router.push({
|
||||
name: 'leave-feedback',
|
||||
params: { rideId: ride._id }
|
||||
});
|
||||
router.push(`/viaggi/feedback/viaggio/${ride._id}`);
|
||||
};
|
||||
|
||||
const acceptRequest = async (request: RideRequest) => {
|
||||
|
||||
@@ -245,6 +245,7 @@ import { defineComponent, ref, computed, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useQuasar, date as qdate } from 'quasar';
|
||||
import { Api } from '@api';
|
||||
import { useAuth } from '../composables/useAuth';
|
||||
|
||||
interface FeedbackStats {
|
||||
averageRating: number;
|
||||
@@ -298,6 +299,10 @@ export default defineComponent({
|
||||
const currentPage = ref(1);
|
||||
const hasMore = ref(false);
|
||||
|
||||
const { user: currentUser } = useAuth();
|
||||
|
||||
const currentUserId = computed(() => currentUser.value?._id);
|
||||
|
||||
// Computed
|
||||
const filteredFeedbacks = computed(() => {
|
||||
return activeTab.value === 'received'
|
||||
@@ -360,9 +365,9 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
const [statsRes, receivedRes, givenRes] = await Promise.all([
|
||||
Api.SendReqWithData('/api/viaggi/feedback/stats', 'GET'),
|
||||
Api.SendReqWithData('/api/viaggi/feedback/received', 'GET'),
|
||||
Api.SendReqWithData('/api/viaggi/feedback/given', 'GET')
|
||||
Api.SendReqWithData('/api/viaggi/feedback/user/' + currentUserId.value + '/stats', 'GET'),
|
||||
Api.SendReqWithData('/api/viaggi/feedback/my/received', 'GET'),
|
||||
Api.SendReqWithData('/api/viaggi/feedback/my/given', 'GET')
|
||||
]);
|
||||
|
||||
if (statsRes.success) {
|
||||
@@ -393,8 +398,8 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
const endpoint = activeTab.value === 'received'
|
||||
? '/api/viaggi/feedback/received'
|
||||
: '/api/viaggi/feedback/given';
|
||||
? '/api/viaggi/feedback/my/received'
|
||||
: '/api/viaggi/feedback/my/given';
|
||||
|
||||
const response = await Api.SendReqWithData(`${endpoint}?page=${currentPage.value}`, 'GET');
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ import { useFeedback } from '../composables/useFeedback';
|
||||
import RideMap from '../components/ride/RideMap.vue';
|
||||
import FeedbackList from '../components/feedback/FeedbackList.vue';
|
||||
import type { Ride, UserBasic, Feedback } from '../types';
|
||||
import { useUserStore } from 'app/src/store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RideDetailPage',
|
||||
@@ -40,8 +41,9 @@ export default defineComponent({
|
||||
const { getOrCreateDirectChat } = useChat();
|
||||
const { fetchRideFeedback, feedbacks: rideFeedbacks } = useFeedback();
|
||||
|
||||
const userStore = useUserStore()
|
||||
// State
|
||||
const currentUserId = ref(''); // TODO: Get from auth
|
||||
const currentUserId = ref<string>(userStore.my._id);
|
||||
const loadingFeedbacks = ref(false);
|
||||
|
||||
// Computed
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useChat } from '../composables/useChat';
|
||||
import CityAutocomplete from '../components/ride/CityAutocomplete.vue';
|
||||
import RideCard from '../components/ride/RideCard.vue';
|
||||
import type { Ride, Location, RideType } from '../types';
|
||||
import { useUserStore } from 'app/src/store';
|
||||
|
||||
interface SearchParams {
|
||||
departure: Location | null;
|
||||
@@ -52,7 +53,8 @@ export default defineComponent({
|
||||
const loadingMore = ref(false);
|
||||
const showAdvanced = ref(false);
|
||||
const sortBy = ref('date_asc');
|
||||
const currentUserId = ref(''); // TODO: Get from auth
|
||||
const userStore = useUserStore()
|
||||
const currentUserId = ref<string>(userStore.my._id);
|
||||
|
||||
const searchParams = reactive<SearchParams>({
|
||||
departure: null,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useChat } from '../composables/useChat';
|
||||
import RideCard from '../components/ride/RideCard.vue';
|
||||
import RideFilters from '../components/ride/RideFilters.vue';
|
||||
import type { Ride, RideSearchFilters, RideType } from '../types';
|
||||
import { useUserStore } from 'app/src/store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RidesListPage',
|
||||
@@ -36,11 +37,10 @@ export default defineComponent({
|
||||
const { getOrCreateDirectChat } = useChat();
|
||||
|
||||
// State
|
||||
const userStore = useUserStore()
|
||||
const activeTab = ref<'all' | 'offers' | 'requests'>('all');
|
||||
const currentUserId = ref(''); // Da ottenere dal tuo auth store
|
||||
const currentUserId = ref<string>(userStore.my._id);
|
||||
|
||||
// TODO: Ottieni currentUserId dal tuo sistema di autenticazione
|
||||
// Esempio: currentUserId.value = authStore.user?._id || '';
|
||||
|
||||
// Computed
|
||||
const filteredRides = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user