diff --git a/data/src/main/java/com/ssing/data/matching/consumermatching/model/ConsumerMatchingActive.kt b/data/src/main/java/com/ssing/data/matching/consumermatching/model/ConsumerMatchingActive.kt index 2f8fea7a..91e941d1 100644 --- a/data/src/main/java/com/ssing/data/matching/consumermatching/model/ConsumerMatchingActive.kt +++ b/data/src/main/java/com/ssing/data/matching/consumermatching/model/ConsumerMatchingActive.kt @@ -25,7 +25,15 @@ data class ConsumerMatchingRequestSummary( val resort: ConsumerMatchingResort, val sport: String, val lessonLevel: String, + val requesterName: String, val headcount: Int, + val participants: List, +) + +data class ConsumerMatchingSummaryParticipant( + val name: String?, + val age: Int, + val gender: String, ) data class ConsumerMatchingResort( diff --git a/data/src/main/java/com/ssing/data/matching/consumermatching/remote/dto/response/ConsumerMatchingActiveResponse.kt b/data/src/main/java/com/ssing/data/matching/consumermatching/remote/dto/response/ConsumerMatchingActiveResponse.kt index fc25f713..b6ba3d69 100644 --- a/data/src/main/java/com/ssing/data/matching/consumermatching/remote/dto/response/ConsumerMatchingActiveResponse.kt +++ b/data/src/main/java/com/ssing/data/matching/consumermatching/remote/dto/response/ConsumerMatchingActiveResponse.kt @@ -26,7 +26,16 @@ internal data class ConsumerMatchingActiveResponse( @SerialName("resort") val resort: Resort, @SerialName("sport") val sport: String, @SerialName("lessonLevel") val lessonLevel: String, + @SerialName("requesterName") val requesterName: String, @SerialName("headcount") val headcount: Int, + @SerialName("participants") val participants: List = emptyList(), + ) + + @Serializable + internal data class Participant( + @SerialName("name") val name: String? = null, + @SerialName("age") val age: Int, + @SerialName("gender") val gender: String, ) @Serializable diff --git a/data/src/main/java/com/ssing/data/matching/consumermatching/repository/impl/ConsumerMatchingRepositoryImpl.kt b/data/src/main/java/com/ssing/data/matching/consumermatching/repository/impl/ConsumerMatchingRepositoryImpl.kt index 29980b06..4269c6b3 100644 --- a/data/src/main/java/com/ssing/data/matching/consumermatching/repository/impl/ConsumerMatchingRepositoryImpl.kt +++ b/data/src/main/java/com/ssing/data/matching/consumermatching/repository/impl/ConsumerMatchingRepositoryImpl.kt @@ -14,6 +14,7 @@ import com.ssing.data.matching.consumermatching.model.ConsumerMatchingProgressSu import com.ssing.data.matching.consumermatching.model.ConsumerMatchingRequestResult import com.ssing.data.matching.consumermatching.model.ConsumerMatchingRequestSummary import com.ssing.data.matching.consumermatching.model.ConsumerMatchingResort +import com.ssing.data.matching.consumermatching.model.ConsumerMatchingSummaryParticipant import com.ssing.data.matching.consumermatching.remote.datasource.api.ConsumerMatchingRemoteDataSource import com.ssing.data.matching.consumermatching.remote.dto.request.ConsumerMatchingConditionRequest import com.ssing.data.matching.consumermatching.remote.dto.request.ConsumerMatchingConfirmationRequest @@ -130,7 +131,15 @@ internal class ConsumerMatchingRepositoryImpl @Inject constructor( ), sport = requestSummary.sport, lessonLevel = requestSummary.lessonLevel, + requesterName = requestSummary.requesterName, headcount = requestSummary.headcount, + participants = requestSummary.participants.map { + ConsumerMatchingSummaryParticipant( + name = it.name, + age = it.age, + gender = it.gender, + ) + }, ), lessonSummary = lessonSummary?.let { ConsumerMatchingLessonSummary( diff --git a/presentation/consumer-home/src/main/java/com/ssing/presentation/consumerhome/ConsumerHomeViewModel.kt b/presentation/consumer-home/src/main/java/com/ssing/presentation/consumerhome/ConsumerHomeViewModel.kt index f719039e..528f16f9 100644 --- a/presentation/consumer-home/src/main/java/com/ssing/presentation/consumerhome/ConsumerHomeViewModel.kt +++ b/presentation/consumer-home/src/main/java/com/ssing/presentation/consumerhome/ConsumerHomeViewModel.kt @@ -77,16 +77,18 @@ internal class ConsumerHomeViewModel @Inject constructor( }.toImmutableList() } - private fun ConsumerLessonCard.toReservation(): Reservation = - Reservation( + private fun ConsumerLessonCard.toReservation(): Reservation { + val status = toCardStatus() + return Reservation( lessonId = lessonId, - chip = toChipText(), + chip = toChipText(status), displayText = title, location = resort.displayName, date = runCatching { OffsetDateTime.parse(scheduledAt).toLocalDateTime() }.getOrNull(), imageRes = toImageRes(), - status = toCardStatus(), + status = status, ) + } private fun ConsumerLessonCard.toImageRes(): Int = when (sport) { "SKI" -> R.drawable.img_ski_86 @@ -94,13 +96,14 @@ internal class ConsumerHomeViewModel @Inject constructor( else -> R.drawable.img_ski_86 } - private fun ConsumerLessonCard.toChipText(): String = when { - displayStatus == IN_PROGRESS -> "진행중" - remainingDays == 0 -> "Now" - else -> "D-$remainingDays" - } + private fun ConsumerLessonCard.toChipText(status: Status): String = + if (status == Status.Default) "D-$remainingDays" else "Now" - private fun ConsumerLessonCard.toCardStatus(): Status = Status.Default + private fun ConsumerLessonCard.toCardStatus(): Status = when { + displayStatus == IN_PROGRESS -> Status.Matching + remainingDays == 0 -> Status.Matched + else -> Status.Default + } private companion object { const val IN_PROGRESS = "IN_PROGRESS" diff --git a/presentation/consumer-matching/src/main/java/com/ssing/presentation/consumermatching/component/InstructorProfileContent.kt b/presentation/consumer-matching/src/main/java/com/ssing/presentation/consumermatching/component/InstructorProfileContent.kt index 50ec62d2..912c872e 100644 --- a/presentation/consumer-matching/src/main/java/com/ssing/presentation/consumermatching/component/InstructorProfileContent.kt +++ b/presentation/consumer-matching/src/main/java/com/ssing/presentation/consumermatching/component/InstructorProfileContent.kt @@ -585,11 +585,9 @@ private fun ReviewCard( overflow = TextOverflow.Ellipsis, ) - Spacer( - Modifier - .weight(1f) - .heightIn(min = 11.dp), - ) + Spacer(Modifier.height(11.dp)) + + Spacer(Modifier.weight(1f)) Text( text = review.date, diff --git a/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentScreen.kt b/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentScreen.kt index 5a5f75ae..525ee6a7 100644 --- a/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentScreen.kt +++ b/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentScreen.kt @@ -156,6 +156,7 @@ private fun PayInfoSection( ) { SsingMatchingDetailCard( nickname = state.nickname, + teamCount = state.participants.size, stepLabel = "결제 정보", stepLabelColor = SSINGTheme.colors.textAlternative, tags = state.tags, diff --git a/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentViewModel.kt b/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentViewModel.kt index 45fbbba9..5aa09bc3 100644 --- a/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentViewModel.kt +++ b/presentation/consumer-payment/src/main/java/com/ssing/presentation/consumerpayment/PaymentViewModel.kt @@ -3,13 +3,17 @@ package com.ssing.presentation.consumerpayment import androidx.lifecycle.viewModelScope import com.ssing.core.network.exception.ApiException import com.ssing.core.ui.base.BaseViewModel +import com.ssing.core.ui.common.component.Gender +import com.ssing.core.ui.common.component.Participant import com.ssing.core.ui.extension.uiMessage import com.ssing.data.matching.consumermatching.model.ConsumerMatchingActive +import com.ssing.data.matching.consumermatching.model.ConsumerMatchingSummaryParticipant import com.ssing.data.matching.consumermatching.repository.api.ConsumerMatchingRepository import com.ssing.data.payment.model.PaymentSummary import com.ssing.data.payment.repository.api.PaymentRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject @@ -42,15 +46,19 @@ internal class PaymentViewModel @Inject constructor( updateState { copy( + nickname = requestSummary.requesterName, tags = persistentListOf( requestSummary.sport.toSport(), requestSummary.lessonLevel.toLessonLevel() ), location = requestSummary.resort.displayName, duration = lessonSummary?.durationMinutes?.toDurationText() ?: duration, + participants = requestSummary.participants.map { it.toParticipant() } + .toPersistentList(), lessonCost = priceSummary?.lessonPriceAmount ?: lessonCost, resortCost = priceSummary?.resortPassFeeAmount ?: resortCost, totalPaymentAmount = priceSummary?.totalPaymentAmount ?: totalPaymentAmount, + equipmentStatus = "착용 완료", ) } } @@ -80,6 +88,15 @@ internal class PaymentViewModel @Inject constructor( else -> "${this / 60}시간 ${this % 60}분" } + private fun ConsumerMatchingSummaryParticipant.toParticipant(): Participant = + Participant(age = age, gender = gender.toGender()) + + private fun String.toGender(): Gender = when (this) { + "MALE" -> Gender.MALE + "FEMALE" -> Gender.FEMALE + else -> Gender.MALE + } + fun onPaymentClick() { if (uiState.value.isLoading) return val matchingRequestId = matchingRequestId ?: run { diff --git a/presentation/instructor-home/src/main/java/com/ssing/presentation/instructorhome/InstructorHomeViewModel.kt b/presentation/instructor-home/src/main/java/com/ssing/presentation/instructorhome/InstructorHomeViewModel.kt index 95cf6f5c..4f879802 100644 --- a/presentation/instructor-home/src/main/java/com/ssing/presentation/instructorhome/InstructorHomeViewModel.kt +++ b/presentation/instructor-home/src/main/java/com/ssing/presentation/instructorhome/InstructorHomeViewModel.kt @@ -80,17 +80,19 @@ internal class InstructorHomeViewModel @Inject constructor( }.toImmutableList() } - private fun InstructorLessonCard.toReservation(): Reservation = - Reservation( + private fun InstructorLessonCard.toReservation(): Reservation { + val status = toReservationStatus() + return Reservation( lessonId = lessonId, offerId = offerId, - chip = toChipText(), + chip = toChipText(status), displayText = title, location = resort.displayName, date = runCatching { OffsetDateTime.parse(scheduledAt).toLocalDateTime() }.getOrNull(), imageRes = toImageRes(), - status = toReservationStatus(), + status = status, ) + } private fun InstructorLessonCard.toImageRes(): Int = when (sport) { "SKI" -> R.drawable.img_ski_86 @@ -98,11 +100,8 @@ internal class InstructorHomeViewModel @Inject constructor( else -> R.drawable.img_ski_86 } - private fun InstructorLessonCard.toChipText(): String = when { - displayStatus == IN_PROGRESS -> "진행중" - remainingDays == 0 -> "Now" - else -> "D-$remainingDays" - } + private fun InstructorLessonCard.toChipText(status: Status): String = + if (status == Status.Default) "D-$remainingDays" else "Now" private fun InstructorLessonCard.toReservationStatus(): Status = when (displayStatus) { @@ -111,8 +110,10 @@ internal class InstructorHomeViewModel @Inject constructor( WAITING_FOR_INSTRUCTOR, WAITING_FOR_CONFIRMATION, PAYMENT_PENDING -> Status.Matched - CONFIRMED, - IN_PROGRESS -> Status.Default + + IN_PROGRESS -> Status.Matching + + CONFIRMED -> Status.Default else -> Status.Default }