@tima2025/react-native-timalender 1.1.8 → 1.1.9

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.
Files changed (93) hide show
  1. package/lib/commonjs/assets/images/Avatar/avatar_boy.png +0 -0
  2. package/lib/commonjs/assets/images/Avatar/avatar_girl.png +0 -0
  3. package/lib/commonjs/assets/images/HomePage/avatar_boy.png +0 -0
  4. package/lib/commonjs/assets/images/HomePage/avatar_girl.png +0 -0
  5. package/lib/commonjs/assets/images/HomePage/ic_down.png +0 -0
  6. package/lib/commonjs/assets/images/HomePage/ic_primary_star.png +0 -0
  7. package/lib/commonjs/assets/images/HomePage/ic_success_star.png +0 -0
  8. package/lib/commonjs/assets/images/HomePage/ic_up.png +0 -0
  9. package/lib/commonjs/assets/images/HomePage/index.js +1 -1
  10. package/lib/commonjs/assets/images/HomePage/index.js.flow +4 -0
  11. package/lib/commonjs/assets/images/HomePage/index.js.map +1 -1
  12. package/lib/commonjs/components/Features/Lender/lenderSlice.js +1 -1
  13. package/lib/commonjs/components/Features/Lender/lenderSlice.js.flow +16 -0
  14. package/lib/commonjs/components/Features/Lender/lenderSlice.js.map +1 -1
  15. package/lib/commonjs/components/Navigation/AppNavigator.js +1 -1
  16. package/lib/commonjs/components/Navigation/AppNavigator.js.flow +8 -0
  17. package/lib/commonjs/components/Navigation/AppNavigator.js.map +1 -1
  18. package/lib/commonjs/components/Navigation/Screens.js +1 -1
  19. package/lib/commonjs/components/Navigation/Screens.js.flow +1 -0
  20. package/lib/commonjs/components/Navigation/Screens.js.map +1 -1
  21. package/lib/commonjs/controllers/Lender.js +1 -1
  22. package/lib/commonjs/controllers/Lender.js.flow +23 -1
  23. package/lib/commonjs/controllers/Lender.js.map +1 -1
  24. package/lib/commonjs/screens/CooperationAgreement/index.js +1 -1
  25. package/lib/commonjs/screens/CooperationAgreement/index.js.flow +2 -1
  26. package/lib/commonjs/screens/CooperationAgreement/index.js.map +1 -1
  27. package/lib/commonjs/screens/DetailHistory/index.js +1 -1
  28. package/lib/commonjs/screens/DetailHistory/index.js.flow +947 -603
  29. package/lib/commonjs/screens/DetailHistory/index.js.map +1 -1
  30. package/lib/commonjs/screens/ListLoan/index.js +1 -1
  31. package/lib/commonjs/screens/ListLoan/index.js.flow +61 -53
  32. package/lib/commonjs/screens/ListLoan/index.js.map +1 -1
  33. package/lib/commonjs/screens/ScheduleMore/index.js +2 -0
  34. package/lib/commonjs/screens/ScheduleMore/index.js.flow +610 -0
  35. package/lib/commonjs/screens/ScheduleMore/index.js.map +1 -0
  36. package/lib/module/assets/images/Avatar/avatar_boy.png +0 -0
  37. package/lib/module/assets/images/Avatar/avatar_girl.png +0 -0
  38. package/lib/module/assets/images/HomePage/avatar_boy.png +0 -0
  39. package/lib/module/assets/images/HomePage/avatar_girl.png +0 -0
  40. package/lib/module/assets/images/HomePage/ic_down.png +0 -0
  41. package/lib/module/assets/images/HomePage/ic_primary_star.png +0 -0
  42. package/lib/module/assets/images/HomePage/ic_success_star.png +0 -0
  43. package/lib/module/assets/images/HomePage/ic_up.png +0 -0
  44. package/lib/module/assets/images/HomePage/index.js +1 -1
  45. package/lib/module/assets/images/HomePage/index.js.map +1 -1
  46. package/lib/module/components/Features/Lender/lenderSlice.js +1 -1
  47. package/lib/module/components/Features/Lender/lenderSlice.js.map +1 -1
  48. package/lib/module/components/Navigation/AppNavigator.js +1 -1
  49. package/lib/module/components/Navigation/AppNavigator.js.map +1 -1
  50. package/lib/module/components/Navigation/Screens.js +1 -1
  51. package/lib/module/components/Navigation/Screens.js.map +1 -1
  52. package/lib/module/controllers/Lender.js +1 -1
  53. package/lib/module/controllers/Lender.js.map +1 -1
  54. package/lib/module/screens/CooperationAgreement/index.js +1 -1
  55. package/lib/module/screens/CooperationAgreement/index.js.map +1 -1
  56. package/lib/module/screens/DetailHistory/index.js +1 -1
  57. package/lib/module/screens/DetailHistory/index.js.map +1 -1
  58. package/lib/module/screens/ListLoan/index.js +1 -1
  59. package/lib/module/screens/ListLoan/index.js.map +1 -1
  60. package/lib/module/screens/ScheduleMore/index.js +2 -0
  61. package/lib/module/screens/ScheduleMore/index.js.map +1 -0
  62. package/lib/typescript/src/assets/images/HomePage/index.d.ts +4 -0
  63. package/lib/typescript/src/assets/images/HomePage/index.d.ts.map +1 -1
  64. package/lib/typescript/src/components/Features/Lender/lenderSlice.d.ts +2 -0
  65. package/lib/typescript/src/components/Features/Lender/lenderSlice.d.ts.map +1 -1
  66. package/lib/typescript/src/components/Navigation/AppNavigator.d.ts.map +1 -1
  67. package/lib/typescript/src/components/Navigation/Screens.d.ts +1 -0
  68. package/lib/typescript/src/components/Navigation/Screens.d.ts.map +1 -1
  69. package/lib/typescript/src/controllers/Lender.d.ts +2 -0
  70. package/lib/typescript/src/controllers/Lender.d.ts.map +1 -1
  71. package/lib/typescript/src/screens/CooperationAgreement/index.d.ts.map +1 -1
  72. package/lib/typescript/src/screens/DetailHistory/index.d.ts.map +1 -1
  73. package/lib/typescript/src/screens/ListLoan/index.d.ts.map +1 -1
  74. package/lib/typescript/src/screens/ScheduleMore/index.d.ts +4 -0
  75. package/lib/typescript/src/screens/ScheduleMore/index.d.ts.map +1 -0
  76. package/package.json +1 -1
  77. package/src/assets/images/Avatar/avatar_boy.png +0 -0
  78. package/src/assets/images/Avatar/avatar_girl.png +0 -0
  79. package/src/assets/images/HomePage/avatar_boy.png +0 -0
  80. package/src/assets/images/HomePage/avatar_girl.png +0 -0
  81. package/src/assets/images/HomePage/ic_down.png +0 -0
  82. package/src/assets/images/HomePage/ic_primary_star.png +0 -0
  83. package/src/assets/images/HomePage/ic_success_star.png +0 -0
  84. package/src/assets/images/HomePage/ic_up.png +0 -0
  85. package/src/assets/images/HomePage/index.ts +4 -0
  86. package/src/components/Features/Lender/lenderSlice.ts +16 -0
  87. package/src/components/Navigation/AppNavigator.tsx +8 -0
  88. package/src/components/Navigation/Screens.ts +1 -0
  89. package/src/controllers/Lender.ts +23 -1
  90. package/src/screens/CooperationAgreement/index.tsx +2 -1
  91. package/src/screens/DetailHistory/index.tsx +947 -603
  92. package/src/screens/ListLoan/index.tsx +61 -53
  93. package/src/screens/ScheduleMore/index.tsx +610 -0
@@ -0,0 +1,2 @@
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _moment=_interopRequireDefault(require("moment"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeLinearGradient=_interopRequireDefault(require("react-native-linear-gradient"));var _Ionicons=_interopRequireDefault(require("react-native-vector-icons/Ionicons"));var _reactRedux=require("react-redux");var _HomePage=_interopRequireDefault(require("../../assets/images/HomePage"));var _Colors=_interopRequireDefault(require("../../common/Colors"));var _index=_interopRequireDefault(require("../../common/constants/index"));var _Container=_interopRequireDefault(require("../../common/Container"));var _FlexRow=_interopRequireDefault(require("../../common/FlexRow"));var _Loading=_interopRequireDefault(require("../../common/Loading"));var _Metrics=require("../../common/Metrics");var _RText=_interopRequireDefault(require("../../common/RText"));var _lenderSlice=require("../../components/Features/Lender/lenderSlice");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/tima/Repository/Tima/dautu/timadautu2025/src/screens/ScheduleMore/index.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var ScheduleMoreScreen=function ScheduleMoreScreen(_ref){var navigation=_ref.navigation,route=_ref.route;var item=route.params.data;var lender=route.params.lender;var dispatch=(0,_reactRedux.useDispatch)();console.log('item: ',item);console.log('lender: ',lender);var _useState=(0,_react.useState)(1),_useState2=(0,_slicedToArray2.default)(_useState,2),tab=_useState2[0],setTab=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),data=_useState4[0],setData=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),isLoading=_useState6[0],setIsLoading=_useState6[1];var getSchedule=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setIsLoading(true);try{var resp=yield dispatch((0,_lenderSlice.getPaymentSchedule)(params));console.log('--------------');console.log('getPaymentSchedule: ',JSON.stringify(resp));if(resp.payload.meta.errCode===200){var _resp$payload;setData(resp==null?void 0:(_resp$payload=resp.payload)==null?void 0:_resp$payload.data);}setIsLoading(false);}catch(error){console.log('catching error get payment schedule: ',error);setIsLoading(false);}});return function(_x){return _ref2.apply(this,arguments);};}(),[]);var tabs=(0,_react.useMemo)(function(){return[{id:1,name:'Kỳ cần thanh toán'},{id:2,name:'Kỳ đã thanh toán'}];},[]);var handleChangeTab=function handleChangeTab(value){setTab(value);};var getStatus=function getStatus(value){switch(value){case'Chưa thanh toán':return'#FF3B30';case'Đã hoàn tất':return'#27AE60';case'Chưa đến hạn thanh toán':return'#FF9500';case'Chưa hoàn tất':return'#FF3B30';default:return'#FF9500';}};var renderItem=function renderItem(_ref3){var item=_ref3.item,index=_ref3.index;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:Object.assign({paddingVertical:12,paddingHorizontal:15,marginHorizontal:16,backgroundColor:'#ffffff',borderRadius:8},_Metrics.Shadow,{marginTop:8}),children:[(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,borderBottomWidth:1,borderColor:'#ccc',justifyContent:'space-between',marginBottom:4},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'center',width:'33.33%',backgroundColor:'#FFF6E9',borderRadius:4,paddingVertical:4},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:item==null?void 0:item.period})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'center',width:'33.33%'},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:"G\u1ED1c"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'center',width:'33.33%'},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:"L\xE3i"})})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:'33.33%',borderRadius:4,paddingVertical:4},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:"Ph\u1EA3i thu"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600',marginRight:20},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyOrigial)," \u0111"]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyInterest)," \u0111"]})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{borderColor:'#E5E5EA',borderWidth:1,borderRadius:1,borderStyle:'dashed'}}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:'33.33%',borderRadius:4,paddingVertical:4},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:"\u0110\xE3 thu"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',marginRight:20},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyOrigialPaid)," \u0111"]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyInterestPaid)," \u0111"]})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{borderColor:'#E5E5EA',borderWidth:1,borderRadius:1,borderStyle:'dashed'}}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between',borderBottomWidth:1,borderColor:'#ccc'},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:'33.33%',borderRadius:4,paddingVertical:4},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333'},children:"Ch\u01B0a thu"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#FF3B30',fontWeight:'600',marginRight:20},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyOrigialCurrent)," \u0111"]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{alignItems:'flex-end',width:'33.33%'},children:(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#FF3B30',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(item==null?void 0:item.moneyInterestCurrent)," \u0111"]})})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{marginTop:12,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsxs)(_FlexRow.default,{children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:_HomePage.default.ic_debt,style:{width:14,height:14,resizeMode:'contain'}}),(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333',marginLeft:8},children:"Ng\xE0y ph\u1EA3i thanh to\xE1n"})]}),(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:(0,_moment.default)(item==null?void 0:item.payDate).format('DD/MM/YYYY')})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{marginTop:12,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsxs)(_FlexRow.default,{children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:_HomePage.default.ic_status,style:{width:14,height:14,resizeMode:'contain'}}),(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#333333',marginLeft:8},children:"Tr\u1EA1ng th\xE1i"})]}),(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:getStatus(item==null?void 0:item.status),fontWeight:'600'},children:item==null?void 0:item.status})]})]});};(0,_react.useEffect)(function(){console.log('id: ',lender==null?void 0:lender.loanID);getSchedule({loanId:item==null?void 0:item.loanId,status:tab});},[tab,getSchedule]);console.log('data: ',data);return(0,_jsxRuntime.jsxs)(_Container.default,{isStatusBar:true,style:{paddingTop:_reactNative.StatusBar.currentHeight||42},children:[(0,_jsxRuntime.jsx)(_reactNativeLinearGradient.default,{colors:['rgba(239, 89, 46, 1)','rgba(255, 142, 79, 1)'],start:{x:0,y:0},end:{x:0,y:1},style:{width:'100%',height:_index.default.widthDevice*732/960,position:'absolute'}}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{height:48,justifyContent:'center',marginTop:4},children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:function onPress(){return navigation.goBack();},style:{width:48,height:48,justifyContent:'center',alignItems:'flex-start',position:'absolute',left:10},children:(0,_jsxRuntime.jsx)(_Ionicons.default,{name:"chevron-back",size:30,color:_Colors.default.WHITE})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:'center'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{alignSelf:'center',textAlign:'center',fontSize:16,fontWeight:'600',color:'#ffffff'},children:lender==null?void 0:lender.customerName}),(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{alignSelf:'center',textAlign:'center',fontSize:10,fontWeight:'400',marginTop:4,color:'#ffffff'},children:lender==null?void 0:lender.contactCode})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_jsxRuntime.jsx)(_FlexRow.default,{style:{marginBottom:12,marginHorizontal:16},children:tabs.map(function(item){return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:function onPress(){return handleChangeTab(item.id);},style:{paddingHorizontal:8,borderRadius:20,backgroundColor:tab===item.id?'#ffffff':'rgba(255, 255, 255, 0.2)',justifyContent:'center',alignItems:'center',marginRight:8,height:32,borderWidth:1,borderColor:tab===item.id?'#EF592E':'#ffffff'},children:(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{color:tab===item.id?'#EF592E':'#ffffff'},children:item.name})},item.id);})})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:Object.assign({paddingVertical:12,paddingHorizontal:15,marginHorizontal:16,backgroundColor:'#ffffff',borderRadius:8},_Metrics.Shadow,{marginBottom:12}),children:[(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,fontWeight:'600',color:'#333333'},children:"S\u1ED1 ti\u1EC1n g\u1ED1c c\xF2n l\u1EA1i (1)-(2)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#EF592E',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.totalMoneyCurrent)," \u0111"]})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#828282',marginLeft:20},children:"G\u1ED1c cho vay (1)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.totalMoney)," \u0111"]})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#828282',marginLeft:20},children:"G\u1ED1c \u0111\xE3 thu (2)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.totalMoneyPaid)," \u0111"]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{borderColor:'#E5E5EA',borderWidth:1,borderRadius:1,borderStyle:'dashed'}}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,fontWeight:'600',color:'#333333'},children:"L\xE3i d\u1EF1 ki\u1EBFn (3)-(4)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#EF592E',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.moneyInterestCurrent)," \u0111"]})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#828282',marginLeft:20},children:"L\xE3i ph\u1EA3i thu (3)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.moneyInterest)," \u0111"]})]}),(0,_jsxRuntime.jsxs)(_FlexRow.default,{style:{paddingVertical:4,justifyContent:'space-between'},children:[(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{fontSize:12,color:'#828282',marginLeft:20},children:"L\xE3i \u0111\xE3 thu (4)"}),(0,_jsxRuntime.jsxs)(_RText.default,{textStyle:{fontSize:12,color:'#333333',fontWeight:'600'},children:[(0,_Metrics.numberWithCommas)(data==null?void 0:data.moneyInterestPaid)," \u0111"]})]})]}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{data:data==null?void 0:data.paymentScheduleDetail,renderItem:renderItem,style:{backgroundColor:'#EBEBEB',borderRadius:24,paddingTop:8},keyExtractor:function keyExtractor(item){var _item$id;return item==null?void 0:(_item$id=item.id)==null?void 0:_item$id.toString();},ListEmptyComponent:function ListEmptyComponent(){return(0,_jsxRuntime.jsx)(_RText.default,{textStyle:{textAlign:'center',marginTop:_reactNative.Dimensions.get('screen').height/4,color:'#828282'},children:"Danh s\xE1ch tr\u1ED1ng"});},contentContainerStyle:{paddingBottom:40}}),isLoading?(0,_jsxRuntime.jsx)(_Loading.default,{}):(0,_jsxRuntime.jsx)(_reactNative.View,{})]});};var _default=exports.default=ScheduleMoreScreen;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,610 @@
1
+ //@ts-nocheck
2
+ import moment from 'moment';
3
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import {
5
+ Dimensions,
6
+ FlatList,
7
+ Image,
8
+ StatusBar,
9
+ TouchableOpacity,
10
+ View,
11
+ } from 'react-native';
12
+ import LinearGradient from 'react-native-linear-gradient';
13
+ import Icon from 'react-native-vector-icons/Ionicons';
14
+ import { useDispatch } from 'react-redux';
15
+ import HomeImages from '../../assets/images/HomePage';
16
+ import Colors from '../../common/Colors';
17
+ import constant from '../../common/constants/index';
18
+ import Container from '../../common/Container';
19
+ import FlexRow from '../../common/FlexRow';
20
+ import Loading from '../../common/Loading';
21
+ import { numberWithCommas, Shadow } from '../../common/Metrics';
22
+ import RText from '../../common/RText';
23
+ import { getPaymentSchedule } from '../../components/Features/Lender/lenderSlice';
24
+ import { AppDispatch } from '../../components/Redux/store';
25
+
26
+ const ScheduleMoreScreen = ({ navigation, route }: any) => {
27
+ const item = route.params.data;
28
+ const lender = route.params.lender;
29
+ const dispatch = useDispatch<AppDispatch>();
30
+ console.log('item: ', item);
31
+ console.log('lender: ', lender);
32
+ const [tab, setTab] = useState<number>(1);
33
+ const [data, setData] = useState<any>(null);
34
+ const [isLoading, setIsLoading] = useState<boolean>(false);
35
+
36
+ const getSchedule = useCallback(
37
+ async (params: { loanId: number; status: number }) => {
38
+ setIsLoading(true);
39
+ try {
40
+ const resp: any = await dispatch(getPaymentSchedule(params));
41
+ console.log('--------------');
42
+ console.log('getPaymentSchedule: ', JSON.stringify(resp));
43
+ if (resp.payload.meta.errCode === 200) {
44
+ setData(resp?.payload?.data);
45
+ }
46
+ setIsLoading(false);
47
+ } catch (error) {
48
+ console.log('catching error get payment schedule: ', error);
49
+ setIsLoading(false);
50
+ }
51
+ },
52
+ []
53
+ );
54
+
55
+ const tabs = useMemo(
56
+ () => [
57
+ {
58
+ id: 1,
59
+ name: 'Kỳ cần thanh toán',
60
+ },
61
+ {
62
+ id: 2,
63
+ name: 'Kỳ đã thanh toán',
64
+ },
65
+ ],
66
+ []
67
+ );
68
+
69
+ const handleChangeTab = (value: number) => {
70
+ setTab(value);
71
+ };
72
+
73
+ const getStatus = (value: string) => {
74
+ switch (value) {
75
+ case 'Chưa thanh toán':
76
+ return '#FF3B30';
77
+ case 'Đã hoàn tất':
78
+ return '#27AE60';
79
+ case 'Chưa đến hạn thanh toán':
80
+ return '#FF9500';
81
+ case 'Chưa hoàn tất':
82
+ return '#FF3B30';
83
+ default:
84
+ return '#FF9500';
85
+ }
86
+ };
87
+
88
+ const renderItem = ({ item, index }: any) => {
89
+ return (
90
+ <View
91
+ style={{
92
+ paddingVertical: 12,
93
+ paddingHorizontal: 15,
94
+ marginHorizontal: 16,
95
+ backgroundColor: '#ffffff',
96
+ // backgroundColor: 'green',
97
+ borderRadius: 8,
98
+ ...Shadow,
99
+ // marginTop: 12,
100
+ // marginBottom: 4,
101
+ marginTop: 8,
102
+ }}
103
+ >
104
+ <FlexRow
105
+ style={{
106
+ paddingVertical: 4,
107
+ borderBottomWidth: 1,
108
+ borderColor: '#ccc',
109
+ justifyContent: 'space-between',
110
+ marginBottom: 4,
111
+ }}
112
+ >
113
+ <View
114
+ style={{
115
+ alignItems: 'center',
116
+ width: '33.33%',
117
+ backgroundColor: '#FFF6E9',
118
+ borderRadius: 4,
119
+ paddingVertical: 4,
120
+ }}
121
+ >
122
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>
123
+ {item?.period}
124
+ </RText>
125
+ </View>
126
+ <View
127
+ style={{
128
+ alignItems: 'center',
129
+ width: '33.33%',
130
+ }}
131
+ >
132
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>Gốc</RText>
133
+ </View>
134
+ <View
135
+ style={{
136
+ alignItems: 'center',
137
+ width: '33.33%',
138
+ }}
139
+ >
140
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>Lãi</RText>
141
+ </View>
142
+ </FlexRow>
143
+ <FlexRow
144
+ style={{
145
+ paddingVertical: 4,
146
+ justifyContent: 'space-between',
147
+ }}
148
+ >
149
+ <View
150
+ style={{
151
+ // alignItems: 'center',
152
+ width: '33.33%',
153
+ borderRadius: 4,
154
+ paddingVertical: 4,
155
+ }}
156
+ >
157
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>
158
+ Phải thu
159
+ </RText>
160
+ </View>
161
+ <View
162
+ style={{
163
+ alignItems: 'flex-end',
164
+ width: '33.33%',
165
+ }}
166
+ >
167
+ <RText
168
+ textStyle={{
169
+ fontSize: 12,
170
+ color: '#333333',
171
+ fontWeight: '600',
172
+ marginRight: 20,
173
+ }}
174
+ >
175
+ {numberWithCommas(item?.moneyOrigial)} đ
176
+ </RText>
177
+ </View>
178
+ <View
179
+ style={{
180
+ alignItems: 'flex-end',
181
+ width: '33.33%',
182
+ }}
183
+ >
184
+ <RText
185
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
186
+ >
187
+ {numberWithCommas(item?.moneyInterest)} đ
188
+ </RText>
189
+ </View>
190
+ </FlexRow>
191
+ <View
192
+ style={{
193
+ borderColor: '#E5E5EA',
194
+ borderWidth: 1,
195
+ borderRadius: 1,
196
+ borderStyle: 'dashed',
197
+ }}
198
+ />
199
+ <FlexRow
200
+ style={{
201
+ paddingVertical: 4,
202
+ justifyContent: 'space-between',
203
+ }}
204
+ >
205
+ <View
206
+ style={{
207
+ // alignItems: 'center',
208
+ width: '33.33%',
209
+ borderRadius: 4,
210
+ paddingVertical: 4,
211
+ }}
212
+ >
213
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>Đã thu</RText>
214
+ </View>
215
+ <View
216
+ style={{
217
+ alignItems: 'flex-end',
218
+ width: '33.33%',
219
+ }}
220
+ >
221
+ <RText
222
+ textStyle={{ fontSize: 12, color: '#333333', marginRight: 20 }}
223
+ >
224
+ {numberWithCommas(item?.moneyOrigialPaid)} đ
225
+ </RText>
226
+ </View>
227
+ <View
228
+ style={{
229
+ alignItems: 'flex-end',
230
+ width: '33.33%',
231
+ }}
232
+ >
233
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>
234
+ {numberWithCommas(item?.moneyInterestPaid)} đ
235
+ </RText>
236
+ </View>
237
+ </FlexRow>
238
+ <View
239
+ style={{
240
+ borderColor: '#E5E5EA',
241
+ borderWidth: 1,
242
+ borderRadius: 1,
243
+ borderStyle: 'dashed',
244
+ }}
245
+ />
246
+ <FlexRow
247
+ style={{
248
+ paddingVertical: 4,
249
+ justifyContent: 'space-between',
250
+ borderBottomWidth: 1,
251
+ borderColor: '#ccc',
252
+ }}
253
+ >
254
+ <View
255
+ style={{
256
+ // alignItems: 'center',
257
+ width: '33.33%',
258
+ borderRadius: 4,
259
+ paddingVertical: 4,
260
+ }}
261
+ >
262
+ <RText textStyle={{ fontSize: 12, color: '#333333' }}>
263
+ Chưa thu
264
+ </RText>
265
+ </View>
266
+ <View
267
+ style={{
268
+ alignItems: 'flex-end',
269
+ width: '33.33%',
270
+ }}
271
+ >
272
+ <RText
273
+ textStyle={{
274
+ fontSize: 12,
275
+ color: '#FF3B30',
276
+ fontWeight: '600',
277
+ marginRight: 20,
278
+ }}
279
+ >
280
+ {numberWithCommas(item?.moneyOrigialCurrent)} đ
281
+ </RText>
282
+ </View>
283
+ <View
284
+ style={{
285
+ alignItems: 'flex-end',
286
+ width: '33.33%',
287
+ }}
288
+ >
289
+ <RText
290
+ textStyle={{ fontSize: 12, color: '#FF3B30', fontWeight: '600' }}
291
+ >
292
+ {numberWithCommas(item?.moneyInterestCurrent)} đ
293
+ </RText>
294
+ </View>
295
+ </FlexRow>
296
+ <FlexRow
297
+ style={{
298
+ marginTop: 12,
299
+ justifyContent: 'space-between',
300
+ }}
301
+ >
302
+ <FlexRow>
303
+ <Image
304
+ source={HomeImages.ic_debt}
305
+ style={{ width: 14, height: 14, resizeMode: 'contain' }}
306
+ />
307
+ <RText
308
+ textStyle={{ fontSize: 12, color: '#333333', marginLeft: 8 }}
309
+ >
310
+ Ngày phải thanh toán
311
+ </RText>
312
+ </FlexRow>
313
+ <RText
314
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
315
+ >
316
+ {moment(item?.payDate).format('DD/MM/YYYY')}
317
+ </RText>
318
+ </FlexRow>
319
+ <FlexRow
320
+ style={{
321
+ marginTop: 12,
322
+ justifyContent: 'space-between',
323
+ }}
324
+ >
325
+ <FlexRow>
326
+ <Image
327
+ source={HomeImages.ic_status}
328
+ style={{ width: 14, height: 14, resizeMode: 'contain' }}
329
+ />
330
+ <RText
331
+ textStyle={{ fontSize: 12, color: '#333333', marginLeft: 8 }}
332
+ >
333
+ Trạng thái
334
+ </RText>
335
+ </FlexRow>
336
+ <RText
337
+ textStyle={{
338
+ fontSize: 12,
339
+ color: getStatus(item?.status),
340
+ fontWeight: '600',
341
+ }}
342
+ >
343
+ {item?.status}
344
+ </RText>
345
+ </FlexRow>
346
+ </View>
347
+ );
348
+ };
349
+
350
+ useEffect(() => {
351
+ console.log('id: ', lender?.loanID);
352
+ getSchedule({ loanId: item?.loanId, status: tab });
353
+ }, [tab, getSchedule]);
354
+
355
+ console.log('data: ', data);
356
+
357
+ return (
358
+ <Container
359
+ isStatusBar
360
+ style={{ paddingTop: StatusBar.currentHeight || 42 }}
361
+ >
362
+ {/* <Image
363
+ source={HomeImages.bg_detail}
364
+ style={{
365
+ width: '100%',
366
+ height: (constant.widthDevice * 732) / 960,
367
+ resizeMode: 'contain',
368
+ position: 'absolute',
369
+ }}
370
+ /> */}
371
+ <LinearGradient
372
+ colors={['rgba(239, 89, 46, 1)', 'rgba(255, 142, 79, 1)']}
373
+ start={{ x: 0, y: 0 }}
374
+ end={{ x: 0, y: 1 }}
375
+ style={{
376
+ width: '100%',
377
+ height: (constant.widthDevice * 732) / 960,
378
+ position: 'absolute',
379
+ }}
380
+ />
381
+ <FlexRow
382
+ style={{
383
+ height: 48,
384
+ justifyContent: 'center',
385
+ marginTop: 4,
386
+ }}
387
+ >
388
+ <TouchableOpacity
389
+ onPress={() => navigation.goBack()}
390
+ style={{
391
+ width: 48,
392
+ height: 48,
393
+ justifyContent: 'center',
394
+ alignItems: 'flex-start',
395
+ position: 'absolute',
396
+ left: 10,
397
+ }}
398
+ >
399
+ <Icon name="chevron-back" size={30} color={Colors.WHITE} />
400
+ </TouchableOpacity>
401
+ <View
402
+ style={{
403
+ alignSelf: 'center',
404
+ // position: 'absolute',
405
+ }}
406
+ >
407
+ <RText
408
+ textStyle={{
409
+ // position: 'absolute',
410
+ alignSelf: 'center',
411
+ textAlign: 'center',
412
+ fontSize: 16,
413
+ fontWeight: '600',
414
+ color: '#ffffff',
415
+ }}
416
+ >
417
+ {lender?.customerName}
418
+ </RText>
419
+ <RText
420
+ textStyle={{
421
+ // position: 'absolute',
422
+ alignSelf: 'center',
423
+ textAlign: 'center',
424
+ fontSize: 10,
425
+ fontWeight: '400',
426
+ marginTop: 4,
427
+ color: '#ffffff',
428
+ }}
429
+ >
430
+ {lender?.contactCode}
431
+ </RText>
432
+ </View>
433
+ </FlexRow>
434
+ {/* tab */}
435
+ <View>
436
+ <FlexRow style={{ marginBottom: 12, marginHorizontal: 16 }}>
437
+ {tabs.map((item) => (
438
+ <TouchableOpacity
439
+ onPress={() => handleChangeTab(item.id)}
440
+ key={item.id}
441
+ style={{
442
+ // paddingVertical: 4,
443
+ paddingHorizontal: 8,
444
+ borderRadius: 20,
445
+ backgroundColor:
446
+ tab === item.id ? '#ffffff' : 'rgba(255, 255, 255, 0.2)',
447
+ justifyContent: 'center',
448
+ alignItems: 'center',
449
+ marginRight: 8,
450
+ height: 32,
451
+ borderWidth: 1,
452
+ borderColor: tab === item.id ? '#EF592E' : '#ffffff',
453
+ }}
454
+ >
455
+ <RText
456
+ textStyle={{ color: tab === item.id ? '#EF592E' : '#ffffff' }}
457
+ >
458
+ {item.name}
459
+ </RText>
460
+ </TouchableOpacity>
461
+ ))}
462
+ </FlexRow>
463
+ </View>
464
+ <View
465
+ style={{
466
+ paddingVertical: 12,
467
+ paddingHorizontal: 15,
468
+ marginHorizontal: 16,
469
+ backgroundColor: '#ffffff',
470
+ // backgroundColor: 'green',
471
+ borderRadius: 8,
472
+ ...Shadow,
473
+ marginBottom: 12,
474
+ }}
475
+ >
476
+ <FlexRow
477
+ style={{
478
+ paddingVertical: 4,
479
+ justifyContent: 'space-between',
480
+ }}
481
+ >
482
+ <RText
483
+ textStyle={{ fontSize: 12, fontWeight: '600', color: '#333333' }}
484
+ >
485
+ Số tiền gốc còn lại (1)-(2)
486
+ </RText>
487
+
488
+ <RText
489
+ textStyle={{ fontSize: 12, color: '#EF592E', fontWeight: '600' }}
490
+ >
491
+ {numberWithCommas(data?.totalMoneyCurrent)} đ
492
+ </RText>
493
+ </FlexRow>
494
+ <FlexRow
495
+ style={{
496
+ paddingVertical: 4,
497
+ justifyContent: 'space-between',
498
+ }}
499
+ >
500
+ <RText textStyle={{ fontSize: 12, color: '#828282', marginLeft: 20 }}>
501
+ Gốc cho vay (1)
502
+ </RText>
503
+
504
+ <RText
505
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
506
+ >
507
+ {numberWithCommas(data?.totalMoney)} đ
508
+ </RText>
509
+ </FlexRow>
510
+ <FlexRow
511
+ style={{
512
+ paddingVertical: 4,
513
+ justifyContent: 'space-between',
514
+ }}
515
+ >
516
+ <RText textStyle={{ fontSize: 12, color: '#828282', marginLeft: 20 }}>
517
+ Gốc đã thu (2)
518
+ </RText>
519
+
520
+ <RText
521
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
522
+ >
523
+ {numberWithCommas(data?.totalMoneyPaid)} đ
524
+ </RText>
525
+ </FlexRow>
526
+
527
+ <View
528
+ style={{
529
+ borderColor: '#E5E5EA',
530
+ borderWidth: 1,
531
+ borderRadius: 1,
532
+ borderStyle: 'dashed',
533
+ }}
534
+ />
535
+ <FlexRow
536
+ style={{
537
+ paddingVertical: 4,
538
+ justifyContent: 'space-between',
539
+ }}
540
+ >
541
+ <RText
542
+ textStyle={{ fontSize: 12, fontWeight: '600', color: '#333333' }}
543
+ >
544
+ Lãi dự kiến (3)-(4)
545
+ </RText>
546
+
547
+ <RText
548
+ textStyle={{ fontSize: 12, color: '#EF592E', fontWeight: '600' }}
549
+ >
550
+ {numberWithCommas(data?.moneyInterestCurrent)} đ
551
+ </RText>
552
+ </FlexRow>
553
+ <FlexRow
554
+ style={{
555
+ paddingVertical: 4,
556
+ justifyContent: 'space-between',
557
+ }}
558
+ >
559
+ <RText textStyle={{ fontSize: 12, color: '#828282', marginLeft: 20 }}>
560
+ Lãi phải thu (3)
561
+ </RText>
562
+
563
+ <RText
564
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
565
+ >
566
+ {numberWithCommas(data?.moneyInterest)} đ
567
+ </RText>
568
+ </FlexRow>
569
+ <FlexRow
570
+ style={{
571
+ paddingVertical: 4,
572
+ justifyContent: 'space-between',
573
+ }}
574
+ >
575
+ <RText textStyle={{ fontSize: 12, color: '#828282', marginLeft: 20 }}>
576
+ Lãi đã thu (4)
577
+ </RText>
578
+
579
+ <RText
580
+ textStyle={{ fontSize: 12, color: '#333333', fontWeight: '600' }}
581
+ >
582
+ {numberWithCommas(data?.moneyInterestPaid)} đ
583
+ </RText>
584
+ </FlexRow>
585
+ </View>
586
+
587
+ <FlatList
588
+ data={data?.paymentScheduleDetail}
589
+ renderItem={renderItem}
590
+ style={{ backgroundColor: '#EBEBEB', borderRadius: 24, paddingTop: 8 }}
591
+ keyExtractor={(item) => item?.id?.toString()}
592
+ ListEmptyComponent={() => (
593
+ <RText
594
+ textStyle={{
595
+ textAlign: 'center',
596
+ marginTop: Dimensions.get('screen').height / 4,
597
+ color: '#828282',
598
+ }}
599
+ >
600
+ Danh sách trống
601
+ </RText>
602
+ )}
603
+ contentContainerStyle={{ paddingBottom: 40 }}
604
+ />
605
+ {isLoading ? <Loading /> : <View />}
606
+ </Container>
607
+ );
608
+ };
609
+
610
+ export default ScheduleMoreScreen;