react-native-timacare 3.3.47 → 3.3.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,10 @@ import { formatDDMMYYY, formatMoney } from '../../utils';
7
7
  import { Api } from '../../services/api';
8
8
  import { color } from '../../theme';
9
9
  import { SkeletonDisbursedList } from '../../components/SkeletonLoanCard';
10
+ import LinearGradient from 'react-native-linear-gradient';
11
+ import { useNavigation } from '@react-navigation/native';
12
+ import { commonStyles } from '../CommonStyles';
13
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
14
 
11
15
  const cardStyle = {
12
16
  backgroundColor: '#FFFFFF',
@@ -43,14 +47,17 @@ const InfoRow = ({ label, value, valueColor = '#1A1A1A' }) => (
43
47
  );
44
48
 
45
49
  export default function InforLoan({ id }: { id: number }) {
50
+ const navigation = useNavigation();
46
51
  const [isLoading, setIsLoading] = useState(false);
47
52
  const [data, setData] = useState<any>();
48
53
  const [expanded, setExpanded] = useState(false);
54
+ const insets = useSafeAreaInsets();
49
55
 
50
56
  const getData = async () => {
51
57
  try {
52
58
  setIsLoading(true);
53
59
  const response = await Api.getInstance().get_detail_loan_tima(id);
60
+ console.log(response);
54
61
  if (response.kind === 'ok') {
55
62
  if (response.data?.meta?.errorCode === 200) {
56
63
  setData(response.data?.data);
@@ -80,120 +87,155 @@ export default function InforLoan({ id }: { id: number }) {
80
87
  }
81
88
 
82
89
  return (
83
- <ScrollView
84
- style={{ flex: 1 }}
85
- contentContainerStyle={{ paddingVertical: 16 }}
86
- >
87
- {/* Thẻ thông tin hợp đồng giải ngân */}
88
- <View style={cardStyle}>
89
- <InfoRow label="Mã HĐ giải ngân" value={data?.contractCode || ''} />
90
- <InfoRow
91
- label="Số tiền giải ngân"
92
- value={`${formatMoney(data?.totalMoneyDisbursement || 0)} đ`}
93
- />
94
- <InfoRow
95
- label="Thời hạn"
96
- value={data?.loanTime ? `${data?.loanTime} tháng` : ''}
97
- />
98
- <InfoRow
99
- label="Ngày giải ngân"
100
- value={data?.fromDate ? formatDDMMYYY(data?.fromDate) : ''}
101
- />
102
- <InfoRow
103
- label="Ngày đến hạn tiếp theo"
104
- value={data?.nextDate ? formatDDMMYYY(data?.nextDate) : ''}
105
- />
106
- <InfoRow label="Trạng thái Hợp đồng" value={data?.statusName || ''} />
107
- </View>
108
-
109
- {/* Thẻ tổng phải trả + trạng thái thanh toán */}
110
- <View
111
- style={[
112
- {
113
- marginTop: 16,
114
- marginHorizontal: 16,
115
- paddingHorizontal: 16,
116
- paddingVertical: 8,
117
- borderRadius: 12,
118
- borderWidth: 1,
119
- borderColor: '#E0E0E0',
120
- },
121
- ]}
90
+ <>
91
+ <ScrollView
92
+ style={{ flex: 1 }}
93
+ contentContainerStyle={{ paddingVertical: 16 }}
122
94
  >
123
- <TouchableOpacity
124
- activeOpacity={0.8}
125
- onPress={() => setExpanded((prev) => !prev)}
126
- style={{
127
- flexDirection: 'row',
128
- alignItems: 'center',
129
- justifyContent: 'space-between',
130
- paddingVertical: 12,
131
- }}
95
+ {/* Thẻ thông tin hợp đồng giải ngân */}
96
+ <View style={cardStyle}>
97
+ <InfoRow label="Mã giải ngân" value={data?.contractCode || ''} />
98
+ <InfoRow
99
+ label="Số tiền giải ngân"
100
+ value={`${formatMoney(data?.totalMoneyDisbursement || 0)} đ`}
101
+ />
102
+ <InfoRow
103
+ label="Thời hạn"
104
+ value={data?.loanTime ? `${data?.loanTime} tháng` : ''}
105
+ />
106
+ <InfoRow
107
+ label="Ngày giải ngân"
108
+ value={data?.fromDate ? formatDDMMYYY(data?.fromDate) : ''}
109
+ />
110
+ <InfoRow
111
+ label="Ngày đến hạn tiếp theo"
112
+ value={data?.nextDate ? formatDDMMYYY(data?.nextDate) : ''}
113
+ />
114
+ <InfoRow label="Trạng thái Hợp đồng" value={data?.statusName || ''} />
115
+ </View>
116
+
117
+ {/* Thẻ tổng phải trả + trạng thái thanh toán */}
118
+ <View
119
+ style={[
120
+ {
121
+ marginTop: 16,
122
+ marginHorizontal: 16,
123
+ paddingHorizontal: 16,
124
+ paddingVertical: 8,
125
+ borderRadius: 12,
126
+ borderWidth: 1,
127
+ borderColor: '#E0E0E0',
128
+ },
129
+ ]}
132
130
  >
133
- <MText style={{ fontSize: 14, color: '#4F4F4F' }}>
134
- Tổng phải trả
135
- </MText>
136
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
137
- <MText
138
- style={{
139
- fontSize: 14,
140
- fontWeight: '600',
141
- fontFamily: 'BeVietnamPro-SemiBold',
142
- color: color.primary,
143
- marginRight: 8,
144
- }}
145
- >
146
- {formatMoney(data?.totalMoneyNeedPay || 0)} đ
131
+ <TouchableOpacity
132
+ activeOpacity={0.8}
133
+ onPress={() => setExpanded((prev) => !prev)}
134
+ style={{
135
+ flexDirection: 'row',
136
+ alignItems: 'center',
137
+ justifyContent: 'space-between',
138
+ paddingVertical: 12,
139
+ }}
140
+ >
141
+ <MText style={{ fontSize: 14, color: '#4F4F4F' }}>
142
+ Tổng phải trả
147
143
  </MText>
148
- <View
149
- style={{
150
- transform: [{ rotate: expanded ? '180deg' : '0deg' }],
151
- }}
152
- >
153
- <IconArrowDown width={14} height={14} fill="#828282" />
154
- </View>
155
- </View>
156
- </TouchableOpacity>
157
- {/* Chi tiết kỳ thanh toán khi mở rộng */}
158
- {expanded &&
159
- data?.schedules?.map((item, index) => (
160
- <View
161
- key={item?.paymentScheduleID || index}
162
- style={{
163
- flexDirection: 'row',
164
- alignItems: 'center',
165
- justifyContent: 'space-between',
166
- paddingVertical: 8,
167
- paddingHorizontal: 24,
168
- }}
169
- >
170
- <MText style={{ fontSize: 13, color: '#828282' }}>
171
- {formatDDMMYYY(item?.payDate)}
172
- </MText>
144
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
173
145
  <MText
174
146
  style={{
175
- fontSize: 13,
176
- color: '#828282',
147
+ fontSize: 14,
148
+ fontWeight: '600',
149
+ fontFamily: 'BeVietnamPro-SemiBold',
150
+ color: color.primary,
151
+ marginRight: 8,
177
152
  }}
178
153
  >
179
- {formatMoney(item?.moneyNeedPay || 0)} đ
154
+ {formatMoney(data?.totalMoneyNeedPay || 0)} đ
180
155
  </MText>
156
+ <View
157
+ style={{
158
+ transform: [{ rotate: expanded ? '180deg' : '0deg' }],
159
+ }}
160
+ >
161
+ <IconArrowDown width={14} height={14} fill="#828282" />
162
+ </View>
181
163
  </View>
182
- ))}
183
- {expanded && (
184
- <View
164
+ </TouchableOpacity>
165
+ {/* Chi tiết kỳ thanh toán khi mở rộng */}
166
+ {expanded &&
167
+ data?.schedules?.map((item, index) => (
168
+ <View
169
+ key={item?.paymentScheduleID || index}
170
+ style={{
171
+ flexDirection: 'row',
172
+ alignItems: 'center',
173
+ justifyContent: 'space-between',
174
+ paddingVertical: 8,
175
+ paddingHorizontal: 24,
176
+ }}
177
+ >
178
+ <MText style={{ fontSize: 13, color: '#828282' }}>
179
+ {formatDDMMYYY(item?.payDate)}
180
+ </MText>
181
+ <MText
182
+ style={{
183
+ fontSize: 13,
184
+ color: '#828282',
185
+ }}
186
+ >
187
+ {formatMoney(item?.moneyNeedPay || 0)} đ
188
+ </MText>
189
+ </View>
190
+ ))}
191
+ {expanded && (
192
+ <View
193
+ style={{
194
+ height: 1,
195
+ backgroundColor: '#E0E0E0',
196
+ }}
197
+ />
198
+ )}
199
+ <InfoRow
200
+ label="Trạng thái"
201
+ value={data?.paymentStatusName || ''}
202
+ valueColor={data?.isPaid ? '#27AE60' : color.primary}
203
+ />
204
+ </View>
205
+ </ScrollView>
206
+ <View
207
+ style={{
208
+ paddingHorizontal: 16,
209
+ marginBottom: insets.bottom,
210
+ }}
211
+ >
212
+ <TouchableOpacity
213
+ onPress={() => {
214
+ navigation.navigate('ShowQrCode', {
215
+ data,
216
+ id: id,
217
+ item: {
218
+ payMoney: data?.totalMoneyNeedPay,
219
+ },
220
+ });
221
+ }}
222
+ >
223
+ <LinearGradient
224
+ colors={['#FF7A00', '#EF4123']}
185
225
  style={{
186
- height: 1,
187
- backgroundColor: '#E0E0E0',
226
+ borderRadius: 30,
227
+ paddingHorizontal: 24,
228
+ alignItems: 'center',
229
+ justifyContent: 'center',
230
+ height: 40,
188
231
  }}
189
- />
190
- )}
191
- <InfoRow
192
- label="Trạng thái"
193
- value={data?.paymentStatusName || ''}
194
- valueColor={data?.isPaid ? '#27AE60' : color.primary}
195
- />
232
+ >
233
+ <MText style={[commonStyles.textNormalBold, { color: '#FDFDFD' }]}>
234
+ Thanh toán
235
+ </MText>
236
+ </LinearGradient>
237
+ </TouchableOpacity>
196
238
  </View>
197
- </ScrollView>
239
+ </>
198
240
  );
199
241
  }