Ignore:
Timestamp:
08/22/26 19:00:38 (8 hours ago)
Author:
veronika-ils <ilioskaveronika@…>
Branches:
master
Parents:
ae83647
Message:

feat: The app is consistent with the changes made in phase 1 and phase 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • petify-frontend/src/views/OwnerProfileView.vue

    rae83647 rf6ed6e4  
    208208
    209209                  <div class="form-group">
     210                    <label class="form-label" for="interactionType">How did you interact?</label>
     211                    <select
     212                      id="interactionType"
     213                      v-model="newReview.interactionType"
     214                      class="form-control"
     215                      required
     216                    >
     217                      <option value="" disabled>Select an option</option>
     218                      <option
     219                        v-for="option in interactionTypeOptions"
     220                        :key="option.value"
     221                        :value="option.value"
     222                      >
     223                        {{ option.label }}
     224                      </option>
     225                    </select>
     226                  </div>
     227
     228                  <div class="form-group">
    210229                    <label class="form-label" for="comment">Comment</label>
    211230                    <textarea
     
    226245                      type="submit"
    227246                      class="btn btn-primary"
    228                       :disabled="isSubmittingReview || newReview.rating === 0"
     247                      :disabled="isSubmittingReview || newReview.rating === 0 || !newReview.interactionType"
    229248                    >
    230249                      <span v-if="isSubmittingReview">Submitting...</span>
     
    287306import { useRoute, RouterLink } from 'vue-router'
    288307import { getUserProfile, getUserListings, getUserPets, loadUserVerificationStatus } from '../api/profile'
    289 import { createReview, getReviewsByOwner, deleteReview as deleteReviewAPI } from '../api/reviews'
     308import {
     309  createReview,
     310  getReviewsByOwner,
     311  deleteReview as deleteReviewAPI,
     312  type UserReviewInteractionType,
     313} from '../api/reviews'
    290314import { useAuthStore } from '../stores/auth'
    291315
     
    305329const isSubmittingReview = ref(false)
    306330const reviewError = ref<string | null>(null)
    307 const newReview = ref({
     331const interactionTypeOptions: Array<{ value: UserReviewInteractionType; label: string }> = [
     332  { value: 'EVENT', label: 'Met at an event' },
     333  { value: 'PERSONAL_INTERACTION', label: 'Personal interaction' },
     334  { value: 'ONLINE', label: 'Online interaction' },
     335  { value: 'PHONE_CALL', label: 'Phone call' },
     336  { value: 'OTHER', label: 'Other' },
     337]
     338
     339const newReview = ref<{
     340  rating: number
     341  comment: string
     342  interactionType: UserReviewInteractionType | ''
     343}>({
    308344  rating: 0,
    309345  comment: '',
     346  interactionType: '',
    310347})
    311348
     
    445482  }
    446483
     484  if (!newReview.value.interactionType) {
     485    reviewError.value = 'Please choose how you interacted with this user'
     486    return
     487  }
     488
    447489  isSubmittingReview.value = true
    448490  reviewError.value = null
     
    453495      auth.user.userId,
    454496      newReview.value.rating,
    455       newReview.value.comment
     497      newReview.value.comment,
     498      newReview.value.interactionType
    456499    )
    457500
     
    459502    newReview.value.rating = 0
    460503    newReview.value.comment = ''
     504    newReview.value.interactionType = ''
    461505    await loadReviews()
    462506  } catch (err) {
Note: See TracChangeset for help on using the changeset viewer.