remboursement nano credit OK
This commit is contained in:
parent
996cdd3aab
commit
1adcfa786e
File diff suppressed because one or more lines are too long
|
@ -167,6 +167,7 @@
|
||||||
"SAVE_MONEY": "Save money",
|
"SAVE_MONEY": "Save money",
|
||||||
"SAVE_MONEY_TYPE": "Savings type",
|
"SAVE_MONEY_TYPE": "Savings type",
|
||||||
"CAUTION_CREDIT": "Caution credit demand",
|
"CAUTION_CREDIT": "Caution credit demand",
|
||||||
|
"CAUTIONNEMENT_DONE": "Caution done",
|
||||||
"ID_DEMAND": "Demand ID",
|
"ID_DEMAND": "Demand ID",
|
||||||
"DATE": "Date",
|
"DATE": "Date",
|
||||||
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",
|
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",
|
||||||
|
|
|
@ -174,6 +174,7 @@
|
||||||
"SAVE_MONEY_TYPE": "Type d'épargne",
|
"SAVE_MONEY_TYPE": "Type d'épargne",
|
||||||
"REFUND_DONE": "Remboursement effectué",
|
"REFUND_DONE": "Remboursement effectué",
|
||||||
"CAUTION_CREDIT": "Cautionner une demande de crédit",
|
"CAUTION_CREDIT": "Cautionner une demande de crédit",
|
||||||
|
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
|
||||||
"ID_DEMAND": "Identifiant de la demande",
|
"ID_DEMAND": "Identifiant de la demande",
|
||||||
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
|
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
|
||||||
"PAIEMENT_ECOLE": "Paiement école",
|
"PAIEMENT_ECOLE": "Paiement école",
|
||||||
|
|
|
@ -1,353 +1,412 @@
|
||||||
import {
|
import {
|
||||||
CREATE_GROUP_PENDING,
|
ASK_NANO_CREDIT_ERROR,
|
||||||
CREATE_GROUP_SUCCESS,
|
ASK_NANO_CREDIT_PENDING,
|
||||||
CREATE_GROUP_ERROR,
|
ASK_NANO_CREDIT_RESET,
|
||||||
CREATE_GROUP_RESET,
|
ASK_NANO_CREDIT_SUCCESS,
|
||||||
GET_DEMAND_GROUP_PENDING,
|
CASSER_EPARGNE_USER_ERROR,
|
||||||
GET_DEMAND_GROUP_SUCCESS,
|
CASSER_EPARGNE_USER_PENDING,
|
||||||
GET_DEMAND_GROUP_ERROR,
|
CASSER_EPARGNE_USER_RESET,
|
||||||
GET_DEMAND_GROUP_RESET,
|
CASSER_EPARGNE_USER_SUCCESS,
|
||||||
GET_UNIQUE_DEMAND_GROUP_PENDING,
|
CAUTION_CREDIT_DEMAND_AGENT_ERROR,
|
||||||
GET_UNIQUE_DEMAND_GROUP_RESET,
|
CAUTION_CREDIT_DEMAND_AGENT_PENDING,
|
||||||
GET_UNIQUE_DEMAND_GROUP_ERROR,
|
CAUTION_CREDIT_DEMAND_AGENT_RESET,
|
||||||
GET_UNIQUE_DEMAND_GROUP_SUCCESS,
|
CAUTION_CREDIT_DEMAND_AGENT_SUCCESS,
|
||||||
TREAT_DEMAND_GROUP_PENDING,
|
CREATE_GROUP_ERROR,
|
||||||
TREAT_DEMAND_GROUP_SUCCESS,
|
CREATE_GROUP_PENDING,
|
||||||
TREAT_DEMAND_GROUP_ERROR,
|
CREATE_GROUP_RESET,
|
||||||
TREAT_DEMAND_GROUP_RESET,
|
CREATE_GROUP_SUCCESS,
|
||||||
JOIN_GROUP_PENDING,
|
EPARGNER_ARGENT_USER_ERROR,
|
||||||
JOIN_GROUP_SUCCESS,
|
EPARGNER_ARGENT_USER_PENDING,
|
||||||
JOIN_GROUP_RESET,
|
EPARGNER_ARGENT_USER_RESET,
|
||||||
JOIN_GROUP_ERROR,
|
EPARGNER_ARGENT_USER_SUCCESS,
|
||||||
GET_USER_GROUP_DETAIL_PENDING,
|
GET_DEMAND_GROUP_ERROR,
|
||||||
GET_USER_GROUP_DETAIL_SUCCESS,
|
GET_DEMAND_GROUP_PENDING,
|
||||||
GET_USER_GROUP_DETAIL_RESET,
|
GET_DEMAND_GROUP_RESET,
|
||||||
GET_USER_GROUP_DETAIL_ERROR,
|
GET_DEMAND_GROUP_SUCCESS,
|
||||||
GET_NOTIFICATIONS_ERROR,
|
GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
|
||||||
GET_NOTIFICATIONS_RESET,
|
GET_EPARGNE_HISTORY_PENDING_USER_PENDING,
|
||||||
GET_NOTIFICATIONS_PENDING,
|
GET_EPARGNE_HISTORY_PENDING_USER_RESET,
|
||||||
GET_NOTIFICATIONS_SUCCESS, ASK_NANO_CREDIT_PENDING, ASK_NANO_CREDIT_SUCCESS, ASK_NANO_CREDIT_ERROR, ASK_NANO_CREDIT_RESET,
|
GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS,
|
||||||
GET_NANO_CREDIT_DEMAND_DURATION_PENDING,
|
GET_NANO_CREDIT_ACCOUNT_USER_ERROR,
|
||||||
GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
|
GET_NANO_CREDIT_ACCOUNT_USER_PENDING,
|
||||||
GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
|
GET_NANO_CREDIT_ACCOUNT_USER_RESET,
|
||||||
GET_NANO_CREDIT_DEMAND_DURATION_RESET,
|
GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS,
|
||||||
REFUND_CREDIT_DEMAND_USER_PENDING,
|
GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
|
||||||
REFUND_CREDIT_DEMAND_USER_RESET,
|
GET_NANO_CREDIT_DEMAND_DETAIL_PENDING,
|
||||||
REFUND_CREDIT_DEMAND_USER_ERROR,
|
GET_NANO_CREDIT_DEMAND_DETAIL_RESET,
|
||||||
CAUTION_CREDIT_DEMAND_AGENT_PENDING,
|
GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
|
||||||
CAUTION_CREDIT_DEMAND_AGENT_RESET,
|
GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
|
||||||
CAUTION_CREDIT_DEMAND_AGENT_ERROR,
|
GET_NANO_CREDIT_DEMAND_DURATION_PENDING,
|
||||||
GET_NANO_CREDIT_DEMAND_DETAIL_PENDING,
|
GET_NANO_CREDIT_DEMAND_DURATION_RESET,
|
||||||
GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
|
GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
|
||||||
GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
|
||||||
GET_NANO_CREDIT_DEMAND_DETAIL_RESET,
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING,
|
||||||
CAUTION_CREDIT_DEMAND_AGENT_SUCCESS,
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET,
|
||||||
EPARGNER_ARGENT_USER_PENDING,
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS,
|
||||||
EPARGNER_ARGENT_USER_SUCCESS,
|
GET_NANO_CREDIT_HISTORY_USER_ERROR,
|
||||||
EPARGNER_ARGENT_USER_ERROR,
|
GET_NANO_CREDIT_HISTORY_USER_PENDING,
|
||||||
EPARGNER_ARGENT_USER_RESET,
|
GET_NANO_CREDIT_HISTORY_USER_RESET,
|
||||||
CASSER_EPARGNE_USER_PENDING,
|
GET_NANO_CREDIT_HISTORY_USER_SUCCESS,
|
||||||
CASSER_EPARGNE_USER_SUCCESS,
|
GET_NOTIFICATIONS_ERROR,
|
||||||
CASSER_EPARGNE_USER_ERROR,
|
GET_NOTIFICATIONS_PENDING,
|
||||||
CASSER_EPARGNE_USER_RESET, GET_NANO_CREDIT_ACCOUNT_USER_PENDING, GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS, GET_NANO_CREDIT_ACCOUNT_USER_ERROR, GET_NANO_CREDIT_ACCOUNT_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_PENDING, GET_NANO_CREDIT_HISTORY_USER_SUCCESS, GET_NANO_CREDIT_HISTORY_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_ERROR
|
GET_NOTIFICATIONS_RESET,
|
||||||
|
GET_NOTIFICATIONS_SUCCESS,
|
||||||
|
GET_UNIQUE_DEMAND_GROUP_ERROR,
|
||||||
|
GET_UNIQUE_DEMAND_GROUP_PENDING,
|
||||||
|
GET_UNIQUE_DEMAND_GROUP_RESET,
|
||||||
|
GET_UNIQUE_DEMAND_GROUP_SUCCESS,
|
||||||
|
GET_USER_GROUP_DETAIL_ERROR,
|
||||||
|
GET_USER_GROUP_DETAIL_PENDING,
|
||||||
|
GET_USER_GROUP_DETAIL_RESET,
|
||||||
|
GET_USER_GROUP_DETAIL_SUCCESS,
|
||||||
|
JOIN_GROUP_ERROR,
|
||||||
|
JOIN_GROUP_PENDING,
|
||||||
|
JOIN_GROUP_RESET,
|
||||||
|
JOIN_GROUP_SUCCESS,
|
||||||
|
REFUND_CREDIT_DEMAND_USER_ERROR,
|
||||||
|
REFUND_CREDIT_DEMAND_USER_PENDING,
|
||||||
|
REFUND_CREDIT_DEMAND_USER_RESET,
|
||||||
|
REFUND_CREDIT_DEMAND_USER_SUCCESS,
|
||||||
|
TREAT_DEMAND_GROUP_ERROR,
|
||||||
|
TREAT_DEMAND_GROUP_PENDING,
|
||||||
|
TREAT_DEMAND_GROUP_RESET,
|
||||||
|
TREAT_DEMAND_GROUP_SUCCESS
|
||||||
} from "../types/NanoCreditType";
|
} from "../types/NanoCreditType";
|
||||||
|
|
||||||
export const fetchCreateGroupPending = () => ({
|
export const fetchCreateGroupPending = () => ({
|
||||||
type: CREATE_GROUP_PENDING
|
type: CREATE_GROUP_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCreateGroupSuccess = (res) => ({
|
export const fetchCreateGroupSuccess = (res) => ({
|
||||||
type: CREATE_GROUP_SUCCESS,
|
type: CREATE_GROUP_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCreateGroupError = (error) => ({
|
export const fetchCreateGroupError = (error) => ({
|
||||||
type: CREATE_GROUP_ERROR,
|
type: CREATE_GROUP_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCreateGroupReset = () => ({
|
export const fetchCreateGroupReset = () => ({
|
||||||
type: CREATE_GROUP_RESET
|
type: CREATE_GROUP_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetDemandsGroupPending = () => ({
|
export const fetchGetDemandsGroupPending = () => ({
|
||||||
type: GET_DEMAND_GROUP_PENDING
|
type: GET_DEMAND_GROUP_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetDemandsGroupSuccess = (res) => ({
|
export const fetchGetDemandsGroupSuccess = (res) => ({
|
||||||
type: GET_DEMAND_GROUP_SUCCESS,
|
type: GET_DEMAND_GROUP_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetDemandsGroupError = (error) => ({
|
export const fetchGetDemandsGroupError = (error) => ({
|
||||||
type: GET_DEMAND_GROUP_ERROR,
|
type: GET_DEMAND_GROUP_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetDemandsGroupReset = () => ({
|
export const fetchGetDemandsGroupReset = () => ({
|
||||||
type: GET_DEMAND_GROUP_RESET
|
type: GET_DEMAND_GROUP_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUniqueDemandsGroupPending = () => ({
|
export const fetchGetUniqueDemandsGroupPending = () => ({
|
||||||
type: GET_UNIQUE_DEMAND_GROUP_PENDING
|
type: GET_UNIQUE_DEMAND_GROUP_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUniqueDemandsGroupSuccess = (res) => ({
|
export const fetchGetUniqueDemandsGroupSuccess = (res) => ({
|
||||||
type: GET_UNIQUE_DEMAND_GROUP_SUCCESS,
|
type: GET_UNIQUE_DEMAND_GROUP_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUniqueDemandsGroupError = (error) => ({
|
export const fetchGetUniqueDemandsGroupError = (error) => ({
|
||||||
type: GET_UNIQUE_DEMAND_GROUP_ERROR,
|
type: GET_UNIQUE_DEMAND_GROUP_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUniqueDemandsGroupReset = () => ({
|
export const fetchGetUniqueDemandsGroupReset = () => ({
|
||||||
type: GET_UNIQUE_DEMAND_GROUP_RESET
|
type: GET_UNIQUE_DEMAND_GROUP_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchTreatDemandsGroupPending = () => ({
|
export const fetchTreatDemandsGroupPending = () => ({
|
||||||
type: TREAT_DEMAND_GROUP_PENDING
|
type: TREAT_DEMAND_GROUP_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchTreatDemandsGroupSuccess = (res) => ({
|
export const fetchTreatDemandsGroupSuccess = (res) => ({
|
||||||
type: TREAT_DEMAND_GROUP_SUCCESS,
|
type: TREAT_DEMAND_GROUP_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchTreatDemandsGroupError = (error) => ({
|
export const fetchTreatDemandsGroupError = (error) => ({
|
||||||
type: TREAT_DEMAND_GROUP_ERROR,
|
type: TREAT_DEMAND_GROUP_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchTreatDemandsGroupReset = () => ({
|
export const fetchTreatDemandsGroupReset = () => ({
|
||||||
type: TREAT_DEMAND_GROUP_RESET
|
type: TREAT_DEMAND_GROUP_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchJoinGroupPending = () => ({
|
export const fetchJoinGroupPending = () => ({
|
||||||
type: JOIN_GROUP_PENDING
|
type: JOIN_GROUP_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchJoinGroupSuccess = (res) => ({
|
export const fetchJoinGroupSuccess = (res) => ({
|
||||||
type: JOIN_GROUP_SUCCESS,
|
type: JOIN_GROUP_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchJoinGroupError = (error) => ({
|
export const fetchJoinGroupError = (error) => ({
|
||||||
type: JOIN_GROUP_ERROR,
|
type: JOIN_GROUP_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchJoinGroupReset = () => ({
|
export const fetchJoinGroupReset = () => ({
|
||||||
type: JOIN_GROUP_RESET
|
type: JOIN_GROUP_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetUserGroupDetailPending = () => ({
|
export const fetchGetUserGroupDetailPending = () => ({
|
||||||
type: GET_USER_GROUP_DETAIL_PENDING
|
type: GET_USER_GROUP_DETAIL_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUserGroupDetailSuccess = (res) => ({
|
export const fetchGetUserGroupDetailSuccess = (res) => ({
|
||||||
type: GET_USER_GROUP_DETAIL_SUCCESS,
|
type: GET_USER_GROUP_DETAIL_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUserGroupDetailError = (error) => ({
|
export const fetchGetUserGroupDetailError = (error) => ({
|
||||||
type: GET_USER_GROUP_DETAIL_ERROR,
|
type: GET_USER_GROUP_DETAIL_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetUserGroupDetailReset = () => ({
|
export const fetchGetUserGroupDetailReset = () => ({
|
||||||
type: GET_USER_GROUP_DETAIL_RESET
|
type: GET_USER_GROUP_DETAIL_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetNotificationPending = () => ({
|
export const fetchGetNotificationPending = () => ({
|
||||||
type: GET_NOTIFICATIONS_PENDING
|
type: GET_NOTIFICATIONS_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNotificationSuccess = (res) => ({
|
export const fetchGetNotificationSuccess = (res) => ({
|
||||||
type: GET_NOTIFICATIONS_SUCCESS,
|
type: GET_NOTIFICATIONS_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNotificationError = (error) => ({
|
export const fetchGetNotificationError = (error) => ({
|
||||||
type: GET_NOTIFICATIONS_ERROR,
|
type: GET_NOTIFICATIONS_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNotificationReset = () => ({
|
export const fetchGetNotificationReset = () => ({
|
||||||
type: GET_NOTIFICATIONS_RESET
|
type: GET_NOTIFICATIONS_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchAskNanoCreditPending = () => ({
|
export const fetchAskNanoCreditPending = () => ({
|
||||||
type: ASK_NANO_CREDIT_PENDING
|
type: ASK_NANO_CREDIT_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchAskNanoCreditSuccess = (res) => ({
|
export const fetchAskNanoCreditSuccess = (res) => ({
|
||||||
type: ASK_NANO_CREDIT_SUCCESS,
|
type: ASK_NANO_CREDIT_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchAskNanoCreditError = (error) => ({
|
export const fetchAskNanoCreditError = (error) => ({
|
||||||
type: ASK_NANO_CREDIT_ERROR,
|
type: ASK_NANO_CREDIT_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchAskNanoCreditReset = () => ({
|
export const fetchAskNanoCreditReset = () => ({
|
||||||
type: ASK_NANO_CREDIT_RESET
|
type: ASK_NANO_CREDIT_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDurationPending = () => ({
|
export const fetchGetNanoCreditDemandDurationPending = () => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DURATION_PENDING
|
type: GET_NANO_CREDIT_DEMAND_DURATION_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDurationSuccess = (res) => ({
|
export const fetchGetNanoCreditDemandDurationSuccess = (res) => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
|
type: GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDurationError = (error) => ({
|
export const fetchGetNanoCreditDemandDurationError = (error) => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
|
type: GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDurationReset = () => ({
|
export const fetchGetNanoCreditDemandDurationReset = () => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DURATION_RESET
|
type: GET_NANO_CREDIT_DEMAND_DURATION_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchCautionCreditDemandUserPending = () => ({
|
export const fetchCautionCreditDemandUserPending = () => ({
|
||||||
type: REFUND_CREDIT_DEMAND_USER_PENDING
|
type: REFUND_CREDIT_DEMAND_USER_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandUserSuccess = (res) => ({
|
export const fetchCautionCreditDemandUserSuccess = (res) => ({
|
||||||
type: REFUND_CREDIT_DEMAND_USER_RESET,
|
type: REFUND_CREDIT_DEMAND_USER_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandUserError = (error) => ({
|
export const fetchCautionCreditDemandUserError = (error) => ({
|
||||||
type: REFUND_CREDIT_DEMAND_USER_ERROR,
|
type: REFUND_CREDIT_DEMAND_USER_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandUserReset = () => ({
|
export const fetchCautionCreditDemandUserReset = () => ({
|
||||||
type: REFUND_CREDIT_DEMAND_USER_RESET
|
type: REFUND_CREDIT_DEMAND_USER_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchCautionCreditDemandAgentPending = () => ({
|
export const fetchCautionCreditDemandAgentPending = () => ({
|
||||||
type: CAUTION_CREDIT_DEMAND_AGENT_PENDING
|
type: CAUTION_CREDIT_DEMAND_AGENT_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandAgentSuccess = (res) => ({
|
export const fetchCautionCreditDemandAgentSuccess = (res) => ({
|
||||||
type: CAUTION_CREDIT_DEMAND_AGENT_SUCCESS,
|
type: CAUTION_CREDIT_DEMAND_AGENT_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandAgentError = (error) => ({
|
export const fetchCautionCreditDemandAgentError = (error) => ({
|
||||||
type: CAUTION_CREDIT_DEMAND_AGENT_ERROR,
|
type: CAUTION_CREDIT_DEMAND_AGENT_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCautionCreditDemandAgentReset = () => ({
|
export const fetchCautionCreditDemandAgentReset = () => ({
|
||||||
type: CAUTION_CREDIT_DEMAND_AGENT_RESET
|
type: CAUTION_CREDIT_DEMAND_AGENT_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDetailPending = () => ({
|
export const fetchGetNanoCreditDemandDetailPending = () => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DETAIL_PENDING
|
type: GET_NANO_CREDIT_DEMAND_DETAIL_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDetailSuccess = (res) => ({
|
export const fetchGetNanoCreditDemandDetailSuccess = (res) => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
|
type: GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDetailError = (error) => ({
|
export const fetchGetNanoCreditDemandDetailError = (error) => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
|
type: GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditDemandDetailReset = () => ({
|
export const fetchGetNanoCreditDemandDetailReset = () => ({
|
||||||
type: GET_NANO_CREDIT_DEMAND_DETAIL_RESET
|
type: GET_NANO_CREDIT_DEMAND_DETAIL_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchEpargnerArgentUserPending = () => ({
|
export const fetchEpargnerArgentUserPending = () => ({
|
||||||
type: EPARGNER_ARGENT_USER_PENDING
|
type: EPARGNER_ARGENT_USER_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchEpargnerArgentUserSuccess = (res) => ({
|
export const fetchEpargnerArgentUserSuccess = (res) => ({
|
||||||
type: EPARGNER_ARGENT_USER_SUCCESS,
|
type: EPARGNER_ARGENT_USER_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchEpargnerArgentUserError = (error) => ({
|
export const fetchEpargnerArgentUserError = (error) => ({
|
||||||
type: EPARGNER_ARGENT_USER_ERROR,
|
type: EPARGNER_ARGENT_USER_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchEpargnerArgentUserReset = () => ({
|
export const fetchEpargnerArgentUserReset = () => ({
|
||||||
type: EPARGNER_ARGENT_USER_RESET
|
type: EPARGNER_ARGENT_USER_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchCasserEpargneUserPending = () => ({
|
export const fetchCasserEpargneUserPending = () => ({
|
||||||
type: CASSER_EPARGNE_USER_PENDING
|
type: CASSER_EPARGNE_USER_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCasserEpargneUserSuccess = (res) => ({
|
export const fetchCasserEpargneUserSuccess = (res) => ({
|
||||||
type: CASSER_EPARGNE_USER_SUCCESS,
|
type: CASSER_EPARGNE_USER_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCasserEpargneUserError = (error) => ({
|
export const fetchCasserEpargneUserError = (error) => ({
|
||||||
type: CASSER_EPARGNE_USER_ERROR,
|
type: CASSER_EPARGNE_USER_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchCasserEpargneUserReset = () => ({
|
export const fetchCasserEpargneUserReset = () => ({
|
||||||
type: CASSER_EPARGNE_USER_RESET
|
type: CASSER_EPARGNE_USER_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserAccountPending = () => ({
|
export const fetchGetNanoCreditUserAccountPending = () => ({
|
||||||
type: GET_NANO_CREDIT_ACCOUNT_USER_PENDING
|
type: GET_NANO_CREDIT_ACCOUNT_USER_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserAccountSuccess = (res) => ({
|
export const fetchGetNanoCreditUserAccountSuccess = (res) => ({
|
||||||
type: GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS,
|
type: GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserAccountError = (error) => ({
|
export const fetchGetNanoCreditUserAccountError = (error) => ({
|
||||||
type: GET_NANO_CREDIT_ACCOUNT_USER_ERROR,
|
type: GET_NANO_CREDIT_ACCOUNT_USER_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserAccountReset = () => ({
|
export const fetchGetNanoCreditUserAccountReset = () => ({
|
||||||
type: GET_NANO_CREDIT_ACCOUNT_USER_RESET
|
type: GET_NANO_CREDIT_ACCOUNT_USER_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserHistoryPending = () => ({
|
export const fetchGetNanoCreditUserHistoryPending = () => ({
|
||||||
type: GET_NANO_CREDIT_HISTORY_USER_PENDING
|
type: GET_NANO_CREDIT_HISTORY_USER_PENDING
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserHistorySuccess = (res) => ({
|
export const fetchGetNanoCreditUserHistorySuccess = (res) => ({
|
||||||
type: GET_NANO_CREDIT_HISTORY_USER_SUCCESS,
|
type: GET_NANO_CREDIT_HISTORY_USER_SUCCESS,
|
||||||
result: res,
|
result: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserHistoryError = (error) => ({
|
export const fetchGetNanoCreditUserHistoryError = (error) => ({
|
||||||
type: GET_NANO_CREDIT_HISTORY_USER_ERROR,
|
type: GET_NANO_CREDIT_HISTORY_USER_ERROR,
|
||||||
result: error
|
result: error
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchGetNanoCreditUserHistoryReset = () => ({
|
export const fetchGetNanoCreditUserHistoryReset = () => ({
|
||||||
type: GET_NANO_CREDIT_HISTORY_USER_RESET
|
type: GET_NANO_CREDIT_HISTORY_USER_RESET
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export const fetchGetNanoCreditUserHistoryInProgressPending = () => ({
|
||||||
|
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNanoCreditUserHistoryInProgressSuccess = (res) => ({
|
||||||
|
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNanoCreditUserHistoryInProgressError = (error) => ({
|
||||||
|
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNanoCreditUserHistoryInProgressReset = () => ({
|
||||||
|
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export const fetchGetEpargneInProgressPending = () => ({
|
||||||
|
type: GET_EPARGNE_HISTORY_PENDING_USER_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetEpargneInProgressSuccess = (res) => ({
|
||||||
|
type: GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetEpargneInProgressError = (error) => ({
|
||||||
|
type: GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetEpargneInProgressReset = () => ({
|
||||||
|
type: GET_EPARGNE_HISTORY_PENDING_USER_RESET
|
||||||
});
|
});
|
|
@ -1,33 +1,42 @@
|
||||||
import { GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_RESET, GET_DEMAND_GROUP_SUCCESS } from "../types/NanoCreditType";
|
import {
|
||||||
|
GET_DEMAND_GROUP_ERROR,
|
||||||
|
GET_DEMAND_GROUP_PENDING,
|
||||||
|
GET_DEMAND_GROUP_RESET,
|
||||||
|
GET_DEMAND_GROUP_SUCCESS
|
||||||
|
} from "../types/NanoCreditType";
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
loading: false,
|
loading: false,
|
||||||
result: null,
|
result: null,
|
||||||
error: null
|
error: null
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = initialState, action) => {
|
export default (state = initialState, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GET_DEMAND_GROUP_PENDING: return {
|
case GET_DEMAND_GROUP_PENDING:
|
||||||
...state,
|
return {
|
||||||
loading: true
|
...state,
|
||||||
}
|
loading: true
|
||||||
case GET_DEMAND_GROUP_SUCCESS: return {
|
}
|
||||||
...state,
|
case GET_DEMAND_GROUP_SUCCESS:
|
||||||
loading: false,
|
return {
|
||||||
result: action.result.data,
|
...state,
|
||||||
error: null
|
loading: false,
|
||||||
}
|
result: action.result.data,
|
||||||
case GET_DEMAND_GROUP_ERROR: return {
|
error: null
|
||||||
...state,
|
}
|
||||||
loading: false,
|
case GET_DEMAND_GROUP_ERROR:
|
||||||
result: null,
|
return {
|
||||||
error: action.result
|
...state,
|
||||||
}
|
loading: false,
|
||||||
case GET_DEMAND_GROUP_RESET: return initialState;
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case GET_DEMAND_GROUP_RESET:
|
||||||
|
return initialState;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import {
|
||||||
|
GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
|
||||||
|
GET_EPARGNE_HISTORY_PENDING_USER_PENDING,
|
||||||
|
GET_EPARGNE_HISTORY_PENDING_USER_RESET,
|
||||||
|
GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS
|
||||||
|
} from "../types/NanoCreditType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case GET_EPARGNE_HISTORY_PENDING_USER_PENDING:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case GET_EPARGNE_HISTORY_PENDING_USER_ERROR:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case GET_EPARGNE_HISTORY_PENDING_USER_RESET:
|
||||||
|
return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,42 @@
|
||||||
|
import {
|
||||||
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
|
||||||
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING,
|
||||||
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET,
|
||||||
|
GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS
|
||||||
|
} from "../types/NanoCreditType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET:
|
||||||
|
return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -44,6 +44,8 @@ import GetNanoCreditHistoryUserReducer from "./GetNanoCreditHistoryUserReducer";
|
||||||
import GetHyperSuperHistoryReducer from "./GetHyperSuperHistoryReducer";
|
import GetHyperSuperHistoryReducer from "./GetHyperSuperHistoryReducer";
|
||||||
import GetBankListReducer from "./GetBankListReducer";
|
import GetBankListReducer from "./GetBankListReducer";
|
||||||
import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
|
import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
|
||||||
|
import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
|
||||||
|
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: 'root',
|
key: 'root',
|
||||||
|
@ -96,7 +98,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
||||||
getNanoCreditHistoryUserReducer: GetNanoCreditHistoryUserReducer,
|
getNanoCreditHistoryUserReducer: GetNanoCreditHistoryUserReducer,
|
||||||
getHyperSuperHistoryReducer: GetHyperSuperHistoryReducer,
|
getHyperSuperHistoryReducer: GetHyperSuperHistoryReducer,
|
||||||
getBankListReducer: GetBankListReducer,
|
getBankListReducer: GetBankListReducer,
|
||||||
envoieUserWalletToBank: EnvoieUserWalletToBank
|
envoieUserWalletToBank: EnvoieUserWalletToBank,
|
||||||
|
getEpargneInProgressReducer: GetEpargneInProgressReducer,
|
||||||
|
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer
|
||||||
});
|
});
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
|
@ -68,12 +68,22 @@ export const CASSER_EPARGNE_USER_SUCCESS = 'CASSER_EPARGNE_USER_SUCCESS';
|
||||||
export const CASSER_EPARGNE_USER_ERROR = 'CASSER_EPARGNE_USER_ERROR';
|
export const CASSER_EPARGNE_USER_ERROR = 'CASSER_EPARGNE_USER_ERROR';
|
||||||
export const CASSER_EPARGNE_USER_RESET = 'CASSER_EPARGNE_USER_RESET';
|
export const CASSER_EPARGNE_USER_RESET = 'CASSER_EPARGNE_USER_RESET';
|
||||||
|
|
||||||
|
export const GET_NANO_CREDIT_HISTORY_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_USER_ERROR';
|
||||||
|
export const GET_NANO_CREDIT_HISTORY_USER_RESET = 'GET_NANO_CREDIT_HISTORY_USER_RESET';
|
||||||
|
export const GET_NANO_CREDIT_HISTORY_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS';
|
||||||
|
export const GET_NANO_CREDIT_HISTORY_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_USER_PENDING';
|
||||||
|
|
||||||
export const GET_NANO_CREDIT_ACCOUNT_USER_PENDING = 'GET_NANO_CREDIT_ACCOUNT_USER_PENDING';
|
export const GET_NANO_CREDIT_ACCOUNT_USER_PENDING = 'GET_NANO_CREDIT_ACCOUNT_USER_PENDING';
|
||||||
export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS';
|
export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS';
|
||||||
export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR';
|
export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR';
|
||||||
export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET';
|
export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET';
|
||||||
|
|
||||||
export const GET_NANO_CREDIT_HISTORY_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_USER_PENDING';
|
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING';
|
||||||
export const GET_NANO_CREDIT_HISTORY_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS';
|
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS';
|
||||||
export const GET_NANO_CREDIT_HISTORY_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_USER_ERROR';
|
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR';
|
||||||
export const GET_NANO_CREDIT_HISTORY_USER_RESET = 'GET_NANO_CREDIT_HISTORY_USER_RESET';
|
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET';
|
||||||
|
|
||||||
|
export const GET_EPARGNE_HISTORY_PENDING_USER_PENDING = 'GET_EPARGNE_HISTORY_PENDING_USER_PENDING';
|
||||||
|
export const GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS = 'GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS';
|
||||||
|
export const GET_EPARGNE_HISTORY_PENDING_USER_ERROR = 'GET_EPARGNE_HISTORY_PENDING_USER_ERROR';
|
||||||
|
export const GET_EPARGNE_HISTORY_PENDING_USER_RESET = 'GET_EPARGNE_HISTORY_PENDING_USER_RESET';
|
||||||
|
|
|
@ -1656,7 +1656,7 @@ class Home extends BaseScreen {
|
||||||
translucent={true}
|
translucent={true}
|
||||||
/>
|
/>
|
||||||
{/* Start here to comment */}
|
{/* Start here to comment */}
|
||||||
{/* {
|
{/*{
|
||||||
(this.state.loadingDialog || this.props.loading) ?
|
(this.state.loadingDialog || this.props.loading) ?
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
|
|
@ -1,26 +1,32 @@
|
||||||
import Button from 'apsl-react-native-button';
|
import Button from 'apsl-react-native-button';
|
||||||
import isEqual from 'lodash/isEqual';
|
import isEqual from 'lodash/isEqual';
|
||||||
import isNil from 'lodash/isNil';
|
import isNil from 'lodash/isNil';
|
||||||
import React, { Component } from 'react';
|
import React, {Component} from 'react';
|
||||||
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
import {Alert, ScrollView, StyleSheet, Text, View} from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import Dialog from "react-native-dialog";
|
import Dialog from "react-native-dialog";
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { store } from "../../redux/store";
|
import {store} from "../../redux/store";
|
||||||
import { Dropdown } from 'react-native-material-dropdown';
|
import {Dropdown} from 'react-native-material-dropdown';
|
||||||
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
import { ProgressDialog } from 'react-native-simple-dialogs';
|
import {ProgressDialog} from 'react-native-simple-dialogs';
|
||||||
import { Fumi } from 'react-native-textinput-effects';
|
import {Fumi} from 'react-native-textinput-effects';
|
||||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import { Color } from '../../config/Color';
|
import {Color} from '../../config/Color';
|
||||||
import { FontWeight, Typography } from '../../config/typography';
|
import {Typography} from '../../config/typography';
|
||||||
import { IlinkEmitter } from '../../utils/events';
|
import {IlinkEmitter} from '../../utils/events';
|
||||||
import { cautionCreditDemandAgentAction, cautionCreditDemandAgentReset, getNanoCreditDemandDetailAction, getNanoCreditDemandDetailReset } from '../../webservice/agent/NanoCreditAgentApi';
|
import {
|
||||||
import { readUser } from '../../webservice/AuthApi';
|
cautionCreditDemandAgentAction,
|
||||||
import { withdrawalMode } from '../../utils/UtilsFunction';
|
cautionCreditDemandAgentReset,
|
||||||
|
getNanoCreditDemandDetailAction,
|
||||||
|
getNanoCreditDemandDetailReset
|
||||||
|
} from '../../webservice/agent/NanoCreditAgentApi';
|
||||||
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
|
import {withdrawalMode} from '../../utils/UtilsFunction';
|
||||||
import thousands from 'thousands';
|
import thousands from 'thousands';
|
||||||
|
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
|
||||||
let theme = require('../../utils/theme.json');
|
let theme = require('../../utils/theme.json');
|
||||||
|
@ -30,478 +36,494 @@ let route = require('../../route.json');
|
||||||
class CautionNanoCreditAgent extends Component {
|
class CautionNanoCreditAgent extends Component {
|
||||||
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
password: null,
|
password: null,
|
||||||
idDemand: null,
|
idDemand: null,
|
||||||
codeGroup: null,
|
codeGroup: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
user: null,
|
user: null,
|
||||||
triggerSubmitClick: false,
|
triggerSubmitClick: false,
|
||||||
isSubmitClick: false,
|
isSubmitClick: false,
|
||||||
isDataSubmit: false,
|
isDataSubmit: false,
|
||||||
withdrawalInCashType: withdrawalMode(),
|
withdrawalInCashType: withdrawalMode(),
|
||||||
withdrawalInCashTypeName: withdrawalMode()[0].name,
|
withdrawalInCashTypeName: withdrawalMode()[0].name,
|
||||||
isModalConfirmVisible: false,
|
isModalConfirmVisible: false,
|
||||||
isGroupToModify: false,
|
isGroupToModify: false,
|
||||||
isModalConfirmVisible: false,
|
withdrawalInCash: true,
|
||||||
withdrawalInCash: true,
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
wallet: store.getState().walletDetailReducer.result.response
|
};
|
||||||
};
|
|
||||||
|
|
||||||
this.props.getNanoCreditDemandDetailReset();
|
this.props.getNanoCreditDemandDetailReset();
|
||||||
this.props.cautionCreditDemandAgentReset();
|
this.props.cautionCreditDemandAgentReset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: Color.primaryColor,
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
statusBarColor: Color.primaryDarkColor,
|
statusBarColor: Color.primaryDarkColor,
|
||||||
navBarTextColor: '#FFFFFF',
|
navBarTextColor: '#FFFFFF',
|
||||||
navBarButtonColor: '#FFFFFF'
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static navigationOptions = () => {
|
static navigationOptions = () => {
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('CAUTION_CREDIT'),
|
headerTitle: I18n.t('CAUTION_CREDIT'),
|
||||||
headerTintColor: 'white',
|
headerTintColor: 'white',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: Color.primaryColor,
|
backgroundColor: Color.primaryColor,
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
color: 'white'
|
color: 'white'
|
||||||
},
|
},
|
||||||
headerTitleStyle: {
|
headerTitleStyle: {
|
||||||
color: "white"
|
color: "white"
|
||||||
},
|
},
|
||||||
title: I18n.t('CAUTION_CREDIT')
|
title: I18n.t('CAUTION_CREDIT')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
this.setState({ user });
|
this.setState({user});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
if (nextProps.resultGetNanoCreditDemandDetail != null) {
|
if (nextProps.resultGetNanoCreditDemandDetail != null) {
|
||||||
|
|
||||||
if (typeof nextProps.resultGetNanoCreditDemandDetail.response !== 'undefined') {
|
if (typeof nextProps.resultGetNanoCreditDemandDetail.response !== 'undefined') {
|
||||||
|
|
||||||
if (!nextProps.loadingGetNanoCreditDemandDetail)
|
if (!nextProps.loadingGetNanoCreditDemandDetail)
|
||||||
this.setState({
|
this.setState({
|
||||||
isModalConfirmVisible: true
|
isModalConfirmVisible: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modalConfirmTransaction = (data) => {
|
modalConfirmTransaction = (data) => {
|
||||||
const idDemand = data.response.id_demande;
|
const idDemand = data.response.id_demande;
|
||||||
const montant = data.response.montant;
|
const montant = data.response.montant;
|
||||||
const duree = data.response.duree_mois;
|
const duree = data.response.duree_mois;
|
||||||
const etat = data.response.etat;
|
const etat = data.response.etat;
|
||||||
const taxe = data.response.taxe;
|
const taxe = data.response.taxe;
|
||||||
const interet = data.response.interet;
|
const interet = data.response.interet;
|
||||||
const dateDemand = data.response.date_demande;
|
const dateDemand = data.response.date_demande;
|
||||||
const dateRemboursementPrevu = data.response.date_remboursement_prevu;
|
const dateRemboursementPrevu = data.response.date_remboursement_prevu;
|
||||||
const dateRemboursement = data.response.date_remboursement;
|
const dateRemboursement = data.response.date_remboursement;
|
||||||
const retraitCash = data.response.retrait_cash;
|
const retraitCash = data.response.retrait_cash;
|
||||||
const dateCreation = data.response.date_creation;
|
const dateCreation = data.response.date_creation;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
|
<Dialog.Container useNativeDriver={true} visible={this.state.isModalConfirmVisible}>
|
||||||
|
|
||||||
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
|
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
|
|
||||||
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
|
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{flex: 1}}>
|
||||||
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
|
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{idDemand}</Text>
|
<Text style={[Typography.caption1, Color.grayColor]}>{idDemand}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{flex: 1}}>
|
||||||
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
|
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
<Text
|
||||||
</View>
|
style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
</View>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
|
<View style={{flex: 1}}>
|
||||||
</View>
|
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
</View>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(taxe, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
</View>
|
<Text
|
||||||
</View>
|
style={[Typography.caption1, Color.grayColor]}>{`${thousands(taxe, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
</View>
|
||||||
<View style={{ flex: 1 }}>
|
</View>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
</View>
|
<View style={{flex: 1}}>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(interet, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
</View>
|
||||||
</View>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
</View>
|
<Text
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
style={[Typography.caption1, Color.grayColor]}>{`${thousands(interet, ' ')} ${this.state.wallet.currency_code}`}</Text>
|
||||||
<View style={{ flex: 1 }}>
|
</View>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_TYPE')}</Text>
|
</View>
|
||||||
</View>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flex: 1}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{retraitCash ? I18n.t('WITHDRAWAL_IN_CASH') : I18n.t('TRANSFER_IN_ACCOUNT')}</Text>
|
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_TYPE')}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
<Text
|
||||||
<View style={{ flex: 1 }}>
|
style={[Typography.caption1, Color.grayColor]}>{retraitCash ? I18n.t('WITHDRAWAL_IN_CASH') : I18n.t('TRANSFER_IN_ACCOUNT')}</Text>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('ETAT')}</Text>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{I18n.t(etat)}</Text>
|
<View style={{flex: 1}}>
|
||||||
</View>
|
<Text tyle={[Typography.body2]}>{I18n.t('ETAT')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
<View style={{ flex: 1 }}>
|
<Text style={[Typography.caption1, Color.grayColor]}>{etat}</Text>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{duree}</Text>
|
<View style={{flex: 1}}>
|
||||||
</View>
|
<Text tyle={[Typography.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
<View style={{ flex: 1 }}>
|
<Text style={[Typography.caption1, Color.grayColor]}>{duree}</Text>
|
||||||
<Text tyle={[Typography.body2]}>{I18n.t('CREATION_DATE')}</Text>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1, alignItems: 'flex-end' }}>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
<Text style={[Typography.caption1, Color.grayColor]}>{moment(dateCreation).format('DD-MM-YYYY')}</Text>
|
<View style={{flex: 1}}>
|
||||||
</View>
|
<Text tyle={[Typography.body2]}>{I18n.t('CREATION_DATE')}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{moment(dateCreation).format('DD-MM-YYYY')}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isModalConfirmVisible: false
|
isModalConfirmVisible: false
|
||||||
});
|
});
|
||||||
}} />
|
}}/>
|
||||||
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isModalConfirmVisible: false,
|
isModalConfirmVisible: false,
|
||||||
isDataSubmit: true
|
isDataSubmit: true
|
||||||
});
|
});
|
||||||
this.props.cautionCreditDemandAgentAction({
|
this.props.cautionCreditDemandAgentAction({
|
||||||
id_demande: this.state.idDemand,
|
id_demande: this.state.idDemand,
|
||||||
id_wallet_agent: this.state.wallet.id,
|
id_wallet_agent: this.state.wallet.id,
|
||||||
retrait_cash: this.state.withdrawalInCash,
|
retrait_cash: this.state.withdrawalInCash,
|
||||||
password: this.state.password
|
password: this.state.password
|
||||||
});
|
});
|
||||||
this.props.getNanoCreditDemandDetailReset();
|
this.props.getNanoCreditDemandDetailReset();
|
||||||
}} />
|
}}/>
|
||||||
|
|
||||||
</Dialog.Container>
|
</Dialog.Container>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ckeckIfFieldIsOK(champ) {
|
ckeckIfFieldIsOK(champ) {
|
||||||
return (isNil(champ) || isEqual(champ.length, 0));
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
renderRefundNanoCreditResponse = () => {
|
renderRefundNanoCreditResponse = () => {
|
||||||
|
|
||||||
const { result, error } = this.props;
|
const {result, error} = this.props;
|
||||||
|
|
||||||
if (error !== null) {
|
if (error !== null) {
|
||||||
if (typeof error.data !== 'undefined') {
|
if (typeof error.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_LABLE"),
|
I18n.t("ERROR_LABLE"),
|
||||||
error.data.error,
|
error.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t("OK"), onPress: () => {
|
||||||
this.props.cautionCreditDemandAgentReset();
|
this.props.cautionCreditDemandAgentReset();
|
||||||
IlinkEmitter.emit("refreshWallet");
|
IlinkEmitter.emit("refreshWallet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{cancelable: false}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result !== null) {
|
if (result !== null) {
|
||||||
if (result.response !== null) {
|
if (result.response !== null) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("REFUND_DONE"),
|
I18n.t("CAUTIONNEMENT_DONE"),
|
||||||
result.response,
|
result.response,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t("OK"), onPress: () => {
|
||||||
this.props.cautionCreditDemandAgentReset();
|
this.props.cautionCreditDemandAgentReset();
|
||||||
IlinkEmitter.emit("refreshWallet");
|
IlinkEmitter.emit("refreshWallet");
|
||||||
this.props.navigation.pop();
|
this.props.navigation.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{cancelable: false}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') })
|
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
|
||||||
this.forceUpdate()
|
this.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
ckeckIfFieldIsOK(champ) {
|
ckeckIfFieldIsOK(champ) {
|
||||||
return (isNil(champ) || isEqual(champ.length, 0));
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmitCautionnerNanoCredit = () => {
|
onSubmitCautionnerNanoCredit = () => {
|
||||||
const { idDemand, password } = this.state;
|
const {idDemand, password} = this.state;
|
||||||
|
|
||||||
if (this.ckeckIfFieldIsOK(idDemand))
|
if (this.ckeckIfFieldIsOK(idDemand))
|
||||||
this.idDemandAnim.shake(800);
|
this.idDemandAnim.shake(800);
|
||||||
else if (this.ckeckIfFieldIsOK(password))
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
this.passwordAnim.shake(800);
|
this.passwordAnim.shake(800);
|
||||||
else {
|
else {
|
||||||
|
|
||||||
this.props.getNanoCreditDemandDetailAction(this.state.idDemand);
|
this.props.getNanoCreditDemandDetailAction(this.state.idDemand);
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
triggerSubmitClick: true
|
triggerSubmitClick: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
renderGetNanoCreditDemandDetailResponse = () => {
|
renderGetNanoCreditDemandDetailResponse = () => {
|
||||||
const { resultGetNanoCreditDemandDetail, errorGetNanoCreditDemandDetail } = this.props;
|
const {resultGetNanoCreditDemandDetail, errorGetNanoCreditDemandDetail} = this.props;
|
||||||
|
|
||||||
if (errorGetNanoCreditDemandDetail !== null) {
|
if (errorGetNanoCreditDemandDetail !== null) {
|
||||||
if (typeof errorGetNanoCreditDemandDetail.data !== 'undefined') {
|
if (typeof errorGetNanoCreditDemandDetail.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t('ERROR_LABEL'),
|
I18n.t('ERROR_LABEL'),
|
||||||
errorGetNanoCreditDemandDetail.data.error,
|
errorGetNanoCreditDemandDetail.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t("OK"), onPress: () => {
|
||||||
this.props.getNanoCreditDemandDetailReset();
|
this.props.getNanoCreditDemandDetailReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{cancelable: false}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t('ERROR_LABEL'),
|
I18n.t('ERROR_LABEL'),
|
||||||
JSON.stringify(errorGetNanoCreditDemandDetail),
|
JSON.stringify(errorGetNanoCreditDemandDetail),
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t("OK"), onPress: () => {
|
||||||
this.props.getNanoCreditDemandDetailAction();
|
this.props.getNanoCreditDemandDetailAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{cancelable: false}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
renderLoader = () => {
|
renderLoader = () => {
|
||||||
return (
|
return (
|
||||||
<ProgressDialog
|
<ProgressDialog
|
||||||
visible={this.props.loading || this.props.loadingGetNanoCreditDemandDetail}
|
visible={this.props.loading || this.props.loadingGetNanoCreditDemandDetail}
|
||||||
title={I18n.t('LOADING')}
|
title={I18n.t('LOADING')}
|
||||||
message={I18n.t('LOADING_INFO')}
|
message={I18n.t('LOADING_INFO')}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { resultGetNanoCreditDemandDetail } = this.props;
|
const {resultGetNanoCreditDemandDetail} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(this.props.loading || this.props.loadingGetNanoCreditDemandDetail) && this.renderLoader()}
|
{(this.props.loading || this.props.loadingGetNanoCreditDemandDetail) && this.renderLoader()}
|
||||||
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
|
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
|
||||||
{
|
{
|
||||||
(resultGetNanoCreditDemandDetail !== null) &&
|
(resultGetNanoCreditDemandDetail !== null) &&
|
||||||
(typeof resultGetNanoCreditDemandDetail.response !== 'undefined') &&
|
(typeof resultGetNanoCreditDemandDetail.response !== 'undefined') &&
|
||||||
this.modalConfirmTransaction(resultGetNanoCreditDemandDetail)
|
this.modalConfirmTransaction(resultGetNanoCreditDemandDetail)
|
||||||
}
|
}
|
||||||
<ScrollView style={styles.container}>
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
|
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.idDemandAnim = comp }}>
|
<Animatable.View ref={(comp) => {
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
this.idDemandAnim = comp
|
||||||
label={I18n.t('ID_DEMAND')}
|
}}>
|
||||||
iconColor={'#f95a25'}
|
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
||||||
iconSize={20}
|
label={I18n.t('ID_DEMAND')}
|
||||||
value={this.state.idDemand}
|
iconColor={'#f95a25'}
|
||||||
onChangeText={(idDemand) => {
|
iconSize={20}
|
||||||
|
value={this.state.idDemand}
|
||||||
|
onChangeText={(idDemand) => {
|
||||||
|
|
||||||
this.setState({ idDemand })
|
this.setState({idDemand})
|
||||||
}}
|
}}
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
>
|
>
|
||||||
</Fumi>
|
</Fumi>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.typeRetraitAnim = comp }}
|
<Animatable.View ref={(comp) => {
|
||||||
style={{
|
this.typeRetraitAnim = comp
|
||||||
width: responsiveWidth(90),
|
}}
|
||||||
height: 60,
|
style={{
|
||||||
marginTop: 20,
|
width: responsiveWidth(90),
|
||||||
alignSelf: 'center',
|
height: 60,
|
||||||
borderRadius: 10,
|
marginTop: 20,
|
||||||
paddingLeft: 20,
|
alignSelf: 'center',
|
||||||
paddingRight: 20,
|
borderRadius: 10,
|
||||||
backgroundColor: 'white'
|
paddingLeft: 20,
|
||||||
}}>
|
paddingRight: 20,
|
||||||
<Dropdown
|
backgroundColor: 'white'
|
||||||
label={I18n.t('WITHDRAWAL_TYPE')}
|
}}>
|
||||||
data={this.state.withdrawalInCashType}
|
<Dropdown
|
||||||
useNativeDriver={true}
|
label={I18n.t('WITHDRAWAL_TYPE')}
|
||||||
value={this.state.withdrawalInCashTypeName}
|
data={this.state.withdrawalInCashType}
|
||||||
onChangeText={(value, index, data) => {
|
useNativeDriver={true}
|
||||||
if (value === I18n.t('WITHDRAWAL_IN_CASH'))
|
value={I18n.t(this.state.withdrawalInCashTypeName)}
|
||||||
this.setState({
|
onChangeText={(value, index, data) => {
|
||||||
withdrawalInCash: true,
|
if (value === I18n.t('WITHDRAWAL_IN_CASH'))
|
||||||
withdrawalInCashTypeName: I18n.t('WITHDRAWAL_IN_CASH')
|
this.setState({
|
||||||
});
|
withdrawalInCash: true,
|
||||||
else
|
withdrawalInCashTypeName: I18n.t('WITHDRAWAL_IN_CASH')
|
||||||
this.setState({
|
});
|
||||||
withdrawalInCash: false,
|
else
|
||||||
withdrawalInCashTypeName: I18n.t('TRANSFER_IN_ACCOUNT')
|
this.setState({
|
||||||
})
|
withdrawalInCash: false,
|
||||||
}}
|
withdrawalInCashTypeName: I18n.t('TRANSFER_IN_ACCOUNT')
|
||||||
valueExtractor={(value) => { return value.name }}
|
})
|
||||||
labelExtractor={(value) => { return value.name }}
|
}}
|
||||||
/>
|
valueExtractor={(value) => {
|
||||||
</Animatable.View>
|
return value.name
|
||||||
|
}}
|
||||||
|
labelExtractor={(value) => {
|
||||||
|
return value.name
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
<Animatable.View ref={(comp) => {
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
this.passwordAnim = comp
|
||||||
label={I18n.t('PASSWORD')}
|
}}>
|
||||||
iconColor={'#f95a25'}
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
iconSize={20}
|
label={I18n.t('PASSWORD')}
|
||||||
secureTextEntry={true}
|
iconColor={'#f95a25'}
|
||||||
value={this.state.password}
|
iconSize={20}
|
||||||
onChangeText={(password) => {
|
secureTextEntry={true}
|
||||||
this.setState({ password })
|
value={this.state.password}
|
||||||
}}
|
onChangeText={(password) => {
|
||||||
style={styles.input}
|
this.setState({password})
|
||||||
>
|
}}
|
||||||
</Fumi>
|
style={styles.input}
|
||||||
</Animatable.View>
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
<Button style={styles.btnvalide}
|
<Button style={styles.btnvalide}
|
||||||
textStyle={styles.textbtnvalide}
|
textStyle={styles.textbtnvalide}
|
||||||
onPress={() => { this.onSubmitCautionnerNanoCredit(); }}>
|
onPress={() => {
|
||||||
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
|
this.onSubmitCautionnerNanoCredit();
|
||||||
</ScrollView>
|
}}>
|
||||||
</>
|
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
)
|
</ScrollView>
|
||||||
}
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const maptStateToProps = state => ({
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
loading: state.cautionCreditDemandAgentReducer.loading,
|
loading: state.cautionCreditDemandAgentReducer.loading,
|
||||||
result: state.cautionCreditDemandAgentReducer.result,
|
result: state.cautionCreditDemandAgentReducer.result,
|
||||||
error: state.cautionCreditDemandAgentReducer.error,
|
error: state.cautionCreditDemandAgentReducer.error,
|
||||||
|
|
||||||
loadingGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.loading,
|
loadingGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.loading,
|
||||||
resultGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.result,
|
resultGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.result,
|
||||||
errorGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.error,
|
errorGetNanoCreditDemandDetail: state.getNanoCreditDemandDetailReducer.error,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
cautionCreditDemandAgentAction,
|
cautionCreditDemandAgentAction,
|
||||||
cautionCreditDemandAgentReset,
|
cautionCreditDemandAgentReset,
|
||||||
|
|
||||||
getNanoCreditDemandDetailAction,
|
getNanoCreditDemandDetailAction,
|
||||||
getNanoCreditDemandDetailReset
|
getNanoCreditDemandDetailReset
|
||||||
|
|
||||||
}, dispatch);
|
}, dispatch);
|
||||||
|
|
||||||
export default connect(maptStateToProps, mapDispatchToProps)(CautionNanoCreditAgent);
|
export default connect(maptStateToProps, mapDispatchToProps)(CautionNanoCreditAgent);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: Color.primaryDarkColor,
|
backgroundColor: Color.primaryDarkColor,
|
||||||
},
|
},
|
||||||
textbtnvalide: {
|
textbtnvalide: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold'
|
||||||
},
|
},
|
||||||
bigtitle: {
|
bigtitle: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
margin: 20,
|
margin: 20,
|
||||||
},
|
},
|
||||||
blockView: {
|
blockView: {
|
||||||
paddingVertical: 10,
|
paddingVertical: 10,
|
||||||
borderBottomWidth: 1
|
borderBottomWidth: 1
|
||||||
},
|
},
|
||||||
subbigtitle: {
|
subbigtitle: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
margin: 5,
|
margin: 5,
|
||||||
},
|
},
|
||||||
btnvalide: {
|
btnvalide: {
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
backgroundColor: Color.accentLightColor,
|
backgroundColor: Color.accentLightColor,
|
||||||
height: 52
|
height: 52
|
||||||
},
|
},
|
||||||
btnSubmit: {
|
btnSubmit: {
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
backgroundColor: Color.accentLightColor,
|
backgroundColor: Color.accentLightColor,
|
||||||
height: 52,
|
height: 52,
|
||||||
width: "30%",
|
width: "30%",
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
height: 60,
|
height: 60,
|
||||||
marginTop: responsiveHeight(2),
|
marginTop: responsiveHeight(2),
|
||||||
marginLeft: responsiveWidth(5),
|
marginLeft: responsiveWidth(5),
|
||||||
marginRight: responsiveWidth(5),
|
marginRight: responsiveWidth(5),
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -1,482 +1,503 @@
|
||||||
import Button from 'apsl-react-native-button';
|
import Button from 'apsl-react-native-button';
|
||||||
import isEqual from 'lodash/isEqual';
|
import isEqual from 'lodash/isEqual';
|
||||||
import isNil from 'lodash/isNil';
|
import isNil from 'lodash/isNil';
|
||||||
import React, { Component } from 'react';
|
import React, {Component} from 'react';
|
||||||
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
import {Alert, ScrollView, StyleSheet, Text, View} from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { Dropdown } from 'react-native-material-dropdown';
|
import {Dropdown} from 'react-native-material-dropdown';
|
||||||
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
import { ProgressDialog } from 'react-native-simple-dialogs';
|
import {ProgressDialog} from 'react-native-simple-dialogs';
|
||||||
import { Fumi } from 'react-native-textinput-effects';
|
import {Fumi} from 'react-native-textinput-effects';
|
||||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import { Color } from '../../config/Color';
|
import {Color} from '../../config/Color';
|
||||||
import { FontWeight, Typography } from '../../config/typography';
|
import {FontWeight, Typography} from '../../config/typography';
|
||||||
import { store } from "../../redux/store";
|
import {store} from "../../redux/store";
|
||||||
import { isNormalInteger, typeEpargne } from '../../utils/UtilsFunction';
|
import {isNormalInteger, typeEpargne} from '../../utils/UtilsFunction';
|
||||||
import { readUser } from '../../webservice/AuthApi';
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
import { getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset } from '../../webservice/NanoCreditApi';
|
import {getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset} from '../../webservice/NanoCreditApi';
|
||||||
import { epargnerArgentUserAction, epargnerArgentUserReset } from "../../webservice/user/NanoCreditApi";
|
import {epargnerArgentUserAction, epargnerArgentUserReset} from "../../webservice/user/NanoCreditApi";
|
||||||
|
import {IlinkEmitter} from "../../utils/events";
|
||||||
|
|
||||||
let theme = require('../../utils/theme.json');
|
let theme = require('../../utils/theme.json');
|
||||||
let route = require('../../route.json');
|
let route = require('../../route.json');
|
||||||
|
|
||||||
|
|
||||||
class EpargnerArgentUser extends Component {
|
class EpargnerArgentUser extends Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: Color.primaryColor,
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
statusBarColor: Color.primaryDarkColor,
|
statusBarColor: Color.primaryDarkColor,
|
||||||
navBarTextColor: '#FFFFFF',
|
navBarTextColor: '#FFFFFF',
|
||||||
navBarButtonColor: '#FFFFFF'
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static navigationOptions = () => {
|
static navigationOptions = () => {
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('SAVE_MONEY'),
|
headerTitle: I18n.t('SAVE_MONEY'),
|
||||||
headerTintColor: 'white',
|
headerTintColor: 'white',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: Color.primaryColor,
|
backgroundColor: Color.primaryColor,
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
color: 'white'
|
color: 'white'
|
||||||
},
|
},
|
||||||
headerTitleStyle: {
|
headerTitleStyle: {
|
||||||
color: "white"
|
color: "white"
|
||||||
},
|
},
|
||||||
title: I18n.t('SAVE_MONEY')
|
title: I18n.t('SAVE_MONEY')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
codeGroupe: null,
|
codeGroupe: null,
|
||||||
codeSponsor: null,
|
codeSponsor: null,
|
||||||
nomGroupe: null,
|
nomGroupe: null,
|
||||||
codeSponsor: null,
|
codeSponsor: null,
|
||||||
displayDuration: false,
|
displayDuration: false,
|
||||||
user: null,
|
user: null,
|
||||||
montant: null,
|
montant: null,
|
||||||
password: null,
|
password: null,
|
||||||
durations: [],
|
durations: [],
|
||||||
durationSelect: null,
|
durationSelect: null,
|
||||||
triggerSubmitClick: false,
|
triggerSubmitClick: false,
|
||||||
hasLoadDuration: false,
|
hasLoadDuration: false,
|
||||||
modalVisible: false,
|
modalVisible: false,
|
||||||
isSubmitClick: false,
|
isSubmitClick: false,
|
||||||
isDataSubmit: false,
|
isDataSubmit: false,
|
||||||
isModalConfirmVisible: false,
|
isModalConfirmVisible: false,
|
||||||
typeEpargne: typeEpargne(),
|
typeEpargne: typeEpargne(),
|
||||||
typeEpargneName: I18n.t((typeEpargne()[0]).name),
|
typeEpargneName: I18n.t((typeEpargne()[0]).name),
|
||||||
typeEpargneToSend: 'simple',
|
typeEpargneToSend: 'simple',
|
||||||
wallet: store.getState().walletDetailReducer.result.response
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
};
|
};
|
||||||
|
|
||||||
this.props.getNanoCreditDemandDurationReset();
|
this.props.getNanoCreditDemandDurationReset();
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
console.log("USER", user);
|
console.log("USER", user);
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
this.props.getNanoCreditDemandDurationAction({ id_user: user.id, type: "epargne" });
|
this.props.getNanoCreditDemandDurationAction({id_user: user.id, type: "epargne"});
|
||||||
};
|
}
|
||||||
}
|
;
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
this.setState({ user });
|
this.setState({user});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const {montant} = this.state;
|
||||||
|
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(montant))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
else if (montant > parseInt(this.state.comptePrincipal))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
renderGetDurationesponse = () => {
|
||||||
|
const {resultGetNanoCreditDuration, errorGetNanoCreditDuration} = this.props;
|
||||||
|
if (resultGetNanoCreditDuration !== null) {
|
||||||
|
if (typeof resultGetNanoCreditDuration.response !== 'undefined') {
|
||||||
|
if (resultGetNanoCreditDuration.response.length > 0) {
|
||||||
|
this.setState({
|
||||||
|
hasLoadDuration: true,
|
||||||
|
durations: resultGetNanoCreditDuration.response,
|
||||||
|
durationSelect: resultGetNanoCreditDuration.response[0].value,
|
||||||
|
modalVisible: false
|
||||||
|
});
|
||||||
|
} else if (resultGetNanoCreditDuration.response.length === 0) {
|
||||||
|
this.setState({
|
||||||
|
hasLoadDuration: true,
|
||||||
|
durations: [],
|
||||||
|
durationSelect: '',
|
||||||
|
modalVisible: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorGetNanoCreditDuration !== null) {
|
||||||
|
if (typeof errorGetNanoCreditDuration.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
errorGetNanoCreditDuration.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getNanoCreditDemandDurationReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_LABEL'),
|
||||||
|
JSON.stringify(errorGetNanoCreditDuration),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getNanoCreditDemandDurationReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderEpargnerArgentResponse = () => {
|
||||||
|
|
||||||
|
const {result, error} = this.props;
|
||||||
|
|
||||||
|
if (error !== null) {
|
||||||
|
if (typeof error.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_LABLE"),
|
||||||
|
error.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.epargnerArgentUserReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
if (result.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("EPARGNE_DEPOSE"),
|
||||||
|
result.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.epargnerArgentUserReset();
|
||||||
|
//IlinkEmitter.emit("treatNanoGroupDemand");
|
||||||
|
IlinkEmitter.emit("updateNanoCreditAccount");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({name: I18n.t('SAVE_MONEY')})
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onSubmitEpargnerArgent = () => {
|
||||||
|
const {montant, typeEpargneName, durationSelect} = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(typeEpargneName))
|
||||||
|
this.typeEpargneAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(durationSelect) && this.state.displayDuration)
|
||||||
|
this.durationAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid)
|
||||||
|
this.montantAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.epargnerArgentUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
type: this.state.typeEpargneToSend,
|
||||||
|
duree_mois: this.state.durationSelect,
|
||||||
|
montant: this.state.montant,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loading || this.props.loadingGetNanoCredit}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loading || this.props.loadingGetNanoCredit || this.state.modalVisible) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderEpargnerArgentResponse()}
|
||||||
|
{!this.state.hasLoadDuration && this.renderGetDurationesponse()}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.typeEpargneAnim = comp
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('SAVE_MONEY_TYPE')}
|
||||||
|
data={this.state.typeEpargne}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.typeEpargneName}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
if (value === I18n.t('SIMPLE'))
|
||||||
|
this.setState({
|
||||||
|
typeEpargneToSend: 'simple',
|
||||||
|
typeEpargneName: I18n.t('SIMPLE'),
|
||||||
|
displayDuration: false
|
||||||
|
|
||||||
|
});
|
||||||
|
else
|
||||||
|
this.setState({
|
||||||
|
typeEpargneToSend: 'blocked',
|
||||||
|
typeEpargneName: I18n.t('BLOCKED'),
|
||||||
|
displayDuration: true
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => {
|
||||||
|
return I18n.t(value.name)
|
||||||
|
}}
|
||||||
|
labelExtractor={(value) => {
|
||||||
|
return I18n.t(value.name)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
{
|
||||||
|
this.state.displayDuration &&
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.durationAnim = comp
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('DEMAND_DURATION_IN_MONTH')}
|
||||||
|
data={this.state.durations}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.durationSelect !== null ? this.state.durationSelect : ''}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({durationSelect: value});
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => {
|
||||||
|
return I18n.t(value.value)
|
||||||
|
}}
|
||||||
|
labelExtractor={(value) => {
|
||||||
|
return I18n.t(value.value)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.montantAnim = comp
|
||||||
|
}}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('AMOUNT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.montant}
|
||||||
|
onChangeText={(montant) => {
|
||||||
|
this.setState({montant})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
ckeckIfFieldIsOK(champ) {
|
}}
|
||||||
return (isNil(champ) || isEqual(champ.length, 0));
|
/>
|
||||||
}
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
isMontantValid = () => {
|
<Animatable.View ref={(comp) => {
|
||||||
const { montant } = this.state;
|
this.passwordAnim = comp
|
||||||
if ((parseInt(isEqual(montant, 0)) || montant < 0))
|
}}>
|
||||||
return {
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
label={I18n.t('PASSWORD')}
|
||||||
isValid: false
|
iconColor={'#f95a25'}
|
||||||
};
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({password})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
else if (!isNormalInteger(montant))
|
<Button style={styles.btnvalide}
|
||||||
return {
|
textStyle={styles.textbtnvalide}
|
||||||
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
onPress={() => {
|
||||||
isValid: false
|
this.onSubmitEpargnerArgent();
|
||||||
};
|
}}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
</ScrollView>
|
||||||
else if (montant > parseInt(this.state.comptePrincipal))
|
</>
|
||||||
return {
|
)
|
||||||
errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),
|
}
|
||||||
isValid: false
|
|
||||||
};
|
|
||||||
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
errorMessage: '',
|
|
||||||
isValid: true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
renderGetDurationesponse = () => {
|
|
||||||
const { resultGetNanoCreditDuration, errorGetNanoCreditDuration } = this.props;
|
|
||||||
if (resultGetNanoCreditDuration !== null) {
|
|
||||||
if (typeof resultGetNanoCreditDuration.response !== 'undefined') {
|
|
||||||
if (resultGetNanoCreditDuration.response.length > 0) {
|
|
||||||
this.setState({
|
|
||||||
hasLoadDuration: true,
|
|
||||||
durations: resultGetNanoCreditDuration.response,
|
|
||||||
durationSelect: resultGetNanoCreditDuration.response[0].value,
|
|
||||||
modalVisible: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (resultGetNanoCreditDuration.response.length === 0) {
|
|
||||||
this.setState({
|
|
||||||
hasLoadDuration: true,
|
|
||||||
durations: [],
|
|
||||||
durationSelect: '',
|
|
||||||
modalVisible: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorGetNanoCreditDuration !== null) {
|
|
||||||
if (typeof errorGetNanoCreditDuration.data !== 'undefined') {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t('ERROR_LABEL'),
|
|
||||||
errorGetNanoCreditDuration.data.error,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: I18n.t("OK"), onPress: () => {
|
|
||||||
this.props.getNanoCreditDemandDurationReset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
{ cancelable: false }
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t('ERROR_LABEL'),
|
|
||||||
JSON.stringify(errorGetNanoCreditDuration),
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: I18n.t("OK"), onPress: () => {
|
|
||||||
this.props.getNanoCreditDemandDurationReset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
{ cancelable: false }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
renderEpargnerArgentResponse = () => {
|
|
||||||
|
|
||||||
const { result, error } = this.props;
|
|
||||||
|
|
||||||
if (error !== null) {
|
|
||||||
if (typeof error.data !== 'undefined') {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t("ERROR_LABLE"),
|
|
||||||
error.data.error,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: I18n.t("OK"), onPress: () => {
|
|
||||||
this.props.epargnerArgentUserReset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
{ cancelable: false }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result !== null) {
|
|
||||||
if (result.response !== null) {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t("EPARGNE_DEPOSE"),
|
|
||||||
result.response,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: I18n.t("OK"), onPress: () => {
|
|
||||||
this.props.epargnerArgentUserReset();
|
|
||||||
//IlinkEmitter.emit("treatNanoGroupDemand");
|
|
||||||
this.props.navigation.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
{ cancelable: false }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateLangue() {
|
|
||||||
this.props.navigation.setParams({ name: I18n.t('SAVE_MONEY') })
|
|
||||||
this.forceUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onSubmitEpargnerArgent = () => {
|
|
||||||
const { montant, typeEpargneName, durationSelect } = this.state;
|
|
||||||
|
|
||||||
if (this.ckeckIfFieldIsOK(typeEpargneName))
|
|
||||||
this.typeEpargneAnim.shake(800);
|
|
||||||
else if (this.ckeckIfFieldIsOK(durationSelect) && this.state.displayDuration)
|
|
||||||
this.durationAnim.shake(800);
|
|
||||||
else if (this.ckeckIfFieldIsOK(montant) || !this.isMontantValid().isValid)
|
|
||||||
this.montantAnim.shake(800);
|
|
||||||
else {
|
|
||||||
|
|
||||||
this.props.epargnerArgentUserAction({
|
|
||||||
id_user: this.state.user.id,
|
|
||||||
type: this.state.typeEpargneToSend,
|
|
||||||
duree_mois: this.state.durationSelect,
|
|
||||||
montant: this.state.montant,
|
|
||||||
password: this.state.password
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
isDataSubmit: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
renderLoader = () => {
|
|
||||||
return (
|
|
||||||
<ProgressDialog
|
|
||||||
visible={this.props.loading || this.props.loadingGetNanoCredit}
|
|
||||||
title={I18n.t('LOADING')}
|
|
||||||
message={I18n.t('LOADING_INFO')}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{(this.props.loading || this.props.loadingGetNanoCredit || this.state.modalVisible) && this.renderLoader()}
|
|
||||||
{this.state.isDataSubmit && this.renderEpargnerArgentResponse()}
|
|
||||||
{!this.state.hasLoadDuration && this.renderGetDurationesponse()}
|
|
||||||
<ScrollView style={styles.container}>
|
|
||||||
|
|
||||||
<Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text>
|
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.typeEpargneAnim = comp }}
|
|
||||||
style={{
|
|
||||||
width: responsiveWidth(90),
|
|
||||||
height: 60,
|
|
||||||
marginTop: 20,
|
|
||||||
alignSelf: 'center',
|
|
||||||
borderRadius: 10,
|
|
||||||
paddingLeft: 20,
|
|
||||||
paddingRight: 20,
|
|
||||||
backgroundColor: 'white'
|
|
||||||
}}>
|
|
||||||
<Dropdown
|
|
||||||
label={I18n.t('SAVE_MONEY_TYPE')}
|
|
||||||
data={this.state.typeEpargne}
|
|
||||||
useNativeDriver={true}
|
|
||||||
value={this.state.typeEpargneName}
|
|
||||||
onChangeText={(value, index, data) => {
|
|
||||||
if (value === I18n.t('SIMPLE'))
|
|
||||||
this.setState({
|
|
||||||
typeEpargneToSend: 'simple',
|
|
||||||
typeEpargneName: I18n.t('SIMPLE'),
|
|
||||||
displayDuration: false
|
|
||||||
|
|
||||||
});
|
|
||||||
else
|
|
||||||
this.setState({
|
|
||||||
typeEpargneToSend: 'blocked',
|
|
||||||
typeEpargneName: I18n.t('BLOCKED'),
|
|
||||||
displayDuration: true
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
valueExtractor={(value) => { return I18n.t(value.name) }}
|
|
||||||
labelExtractor={(value) => { return I18n.t(value.name) }}
|
|
||||||
/>
|
|
||||||
</Animatable.View>
|
|
||||||
|
|
||||||
{
|
|
||||||
this.state.displayDuration &&
|
|
||||||
<Animatable.View ref={(comp) => { this.durationAnim = comp }}
|
|
||||||
style={{
|
|
||||||
width: responsiveWidth(90),
|
|
||||||
height: 60,
|
|
||||||
marginTop: 20,
|
|
||||||
alignSelf: 'center',
|
|
||||||
borderRadius: 10,
|
|
||||||
paddingLeft: 20,
|
|
||||||
paddingRight: 20,
|
|
||||||
backgroundColor: 'white'
|
|
||||||
}}>
|
|
||||||
<Dropdown
|
|
||||||
label={I18n.t('DEMAND_DURATION_IN_MONTH')}
|
|
||||||
data={this.state.durations}
|
|
||||||
useNativeDriver={true}
|
|
||||||
value={this.state.durationSelect !== null ? this.state.durationSelect : ''}
|
|
||||||
onChangeText={(value, index, data) => {
|
|
||||||
this.setState({ durationSelect: value });
|
|
||||||
}}
|
|
||||||
valueExtractor={(value) => { return I18n.t(value.value) }}
|
|
||||||
labelExtractor={(value) => { return I18n.t(value.value) }}
|
|
||||||
/>
|
|
||||||
</Animatable.View>
|
|
||||||
}
|
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.montantAnim = comp }}>
|
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
|
||||||
label={I18n.t('AMOUNT')}
|
|
||||||
iconColor={'#f95a25'}
|
|
||||||
keyboardType='numeric'
|
|
||||||
iconSize={20}
|
|
||||||
value={this.state.montant}
|
|
||||||
onChangeText={(montant) => {
|
|
||||||
this.setState({ montant })
|
|
||||||
}}
|
|
||||||
style={styles.input}
|
|
||||||
>
|
|
||||||
</Fumi>
|
|
||||||
<View style={{
|
|
||||||
position: 'absolute',
|
|
||||||
left: responsiveWidth(82),
|
|
||||||
top: 35,
|
|
||||||
flexDirection: 'row'
|
|
||||||
}}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
width: 1,
|
|
||||||
borderLeftColor: '#f0f0f0',
|
|
||||||
height: 40,
|
|
||||||
left: -8,
|
|
||||||
top: -10,
|
|
||||||
borderLeftWidth: 1,
|
|
||||||
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
|
||||||
</View>
|
|
||||||
</Animatable.View>
|
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
|
||||||
label={I18n.t('PASSWORD')}
|
|
||||||
iconColor={'#f95a25'}
|
|
||||||
iconSize={20}
|
|
||||||
secureTextEntry={true}
|
|
||||||
value={this.state.password}
|
|
||||||
onChangeText={(password) => {
|
|
||||||
this.setState({ password })
|
|
||||||
}}
|
|
||||||
style={styles.input}
|
|
||||||
>
|
|
||||||
</Fumi>
|
|
||||||
</Animatable.View>
|
|
||||||
|
|
||||||
<Button style={styles.btnvalide}
|
|
||||||
textStyle={styles.textbtnvalide}
|
|
||||||
onPress={() => { this.onSubmitEpargnerArgent(); }}>
|
|
||||||
{I18n.t('SUBMIT_LABEL')}</Button>
|
|
||||||
</ScrollView>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const maptStateToProps = state => ({
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
loading: state.epargnerArgentUserReducer.loading,
|
loading: state.epargnerArgentUserReducer.loading,
|
||||||
result: state.epargnerArgentUserReducer.result,
|
result: state.epargnerArgentUserReducer.result,
|
||||||
error: state.epargnerArgentUserReducer.error,
|
error: state.epargnerArgentUserReducer.error,
|
||||||
|
|
||||||
loadingGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.loading,
|
loadingGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.loading,
|
||||||
resultGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.result,
|
resultGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.result,
|
||||||
errorGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.error,
|
errorGetNanoCreditDuration: state.getNanoCreditDemandDurationReducer.error,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
epargnerArgentUserAction,
|
epargnerArgentUserAction,
|
||||||
epargnerArgentUserReset,
|
epargnerArgentUserReset,
|
||||||
|
|
||||||
getNanoCreditDemandDurationAction,
|
getNanoCreditDemandDurationAction,
|
||||||
getNanoCreditDemandDurationReset
|
getNanoCreditDemandDurationReset
|
||||||
|
|
||||||
}, dispatch);
|
}, dispatch);
|
||||||
|
|
||||||
export default connect(maptStateToProps, mapDispatchToProps)(EpargnerArgentUser);
|
export default connect(maptStateToProps, mapDispatchToProps)(EpargnerArgentUser);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: Color.primaryDarkColor,
|
backgroundColor: Color.primaryDarkColor,
|
||||||
},
|
},
|
||||||
textbtnvalide: {
|
textbtnvalide: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold'
|
||||||
},
|
},
|
||||||
bigtitle: {
|
bigtitle: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
margin: 20,
|
margin: 20,
|
||||||
},
|
},
|
||||||
blockView: {
|
blockView: {
|
||||||
paddingVertical: 10,
|
paddingVertical: 10,
|
||||||
borderBottomWidth: 1
|
borderBottomWidth: 1
|
||||||
},
|
},
|
||||||
subbigtitle: {
|
subbigtitle: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
margin: 5,
|
margin: 5,
|
||||||
},
|
},
|
||||||
btnvalide: {
|
btnvalide: {
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
backgroundColor: Color.accentLightColor,
|
backgroundColor: Color.accentLightColor,
|
||||||
height: 52
|
height: 52
|
||||||
},
|
},
|
||||||
btnSubmit: {
|
btnSubmit: {
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
backgroundColor: Color.accentLightColor,
|
backgroundColor: Color.accentLightColor,
|
||||||
height: 52,
|
height: 52,
|
||||||
width: "30%",
|
width: "30%",
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
height: 60,
|
height: 60,
|
||||||
marginTop: responsiveHeight(2),
|
marginTop: responsiveHeight(2),
|
||||||
marginLeft: responsiveWidth(5),
|
marginLeft: responsiveWidth(5),
|
||||||
marginRight: responsiveWidth(5),
|
marginRight: responsiveWidth(5),
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -0,0 +1,692 @@
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
|
Alert,
|
||||||
|
Platform,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View
|
||||||
|
} from 'react-native';
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
|
import {ProgressDialog} from 'react-native-simple-dialogs';
|
||||||
|
import {connect} from 'react-redux';
|
||||||
|
import omit from 'lodash/omit';
|
||||||
|
import {bindActionCreators} from 'redux';
|
||||||
|
import {Color} from '../../config/Color';
|
||||||
|
import {IlinkEmitter} from '../../utils/events';
|
||||||
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
|
import {refundCreditDemandUserAction, refundCreditDemandUserReset} from '../../webservice/user/NanoCreditApi';
|
||||||
|
import {
|
||||||
|
getNanoCreditUserHistoryInProgressAction,
|
||||||
|
getNanoCreditUserHistoryInProgressReset,
|
||||||
|
} from "../../webservice/NanoCreditApi";
|
||||||
|
import {Typography} from "../../config/typography";
|
||||||
|
import {cutStringWithoutDot, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
|
||||||
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import thousands from "thousands";
|
||||||
|
import * as Utils from "../../utils/DeviceUtils";
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
|
||||||
|
let theme = require('../../utils/theme.json');
|
||||||
|
let route = require('../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class RefundNanoCreditUser extends Component {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
password: null,
|
||||||
|
idDemand: null,
|
||||||
|
codeGroup: null,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
isGroupToModify: false,
|
||||||
|
displayModalHistory: false,
|
||||||
|
historyItemDetail: null,
|
||||||
|
isDataHasLoaded: false,
|
||||||
|
displayPasswordModal: false,
|
||||||
|
wallet: this.props.navigation.state.params.wallet,
|
||||||
|
|
||||||
|
};
|
||||||
|
this.props.getNanoCreditUserHistoryInProgressReset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('REFUND_NANO_CREDIT'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('REFUND_NANO_CREDIT')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({user});
|
||||||
|
this.props.getNanoCreditUserHistoryInProgressAction(user.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
renderRefundNanoCreditResponse = () => {
|
||||||
|
|
||||||
|
const {result, error} = this.props;
|
||||||
|
|
||||||
|
if (error !== null) {
|
||||||
|
if (typeof error.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_LABLE"),
|
||||||
|
error.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.refundCreditDemandUserReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
if (result.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("REFUND_DONE"),
|
||||||
|
result.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.refundCreditDemandUserReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
IlinkEmitter.emit("updateNanoCreditAccount");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitRefundNanoCredit = () => {
|
||||||
|
const {idDemand, password} = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(idDemand))
|
||||||
|
this.idDemandAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.refundCreditDemandUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
id_demande: this.state.idDemand,
|
||||||
|
password: this.state.password
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loading || this.props.loadingGetCommission}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderModalHistoryDetail = () => {
|
||||||
|
return (
|
||||||
|
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.displayModalHistory}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
|
||||||
|
{
|
||||||
|
<ScrollView>
|
||||||
|
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('ID_EPARGNE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_epargne}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('ETAT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('HISTORY_TYPE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('FINAL_DATE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
}
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
displayModalHistory: !this.state.displayModalHistory,
|
||||||
|
});
|
||||||
|
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
displayPasswordModal: !this.state.displayPasswordModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
</Dialog.Container>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderPasswordDialog = () => {
|
||||||
|
return (
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.displayPasswordModal}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('PASSWORD')}</Dialog.Title>
|
||||||
|
|
||||||
|
<Dialog.Input placeholder={I18n.t('PLEASE_ENTER_THE_PASSWORD')}
|
||||||
|
style={{borderBottomWidth: 1, borderBottomColor: Color.borderColor}}
|
||||||
|
showSoftInputOnFocus={true}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({password})
|
||||||
|
}}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onSubmitEditing={() => {
|
||||||
|
this.props.refundCreditDemandUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
id_demande: this.state.historyItemDetail.id_epargne,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
<Dialog.Button label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({displayPasswordModal: !this.state.displayPasswordModal});
|
||||||
|
}}/>
|
||||||
|
<Dialog.Button label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
displayPasswordModal: false,
|
||||||
|
displayModalHistory: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
})
|
||||||
|
this.props.refundCreditDemandUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
id_demande: this.state.historyItemDetail.id_epargne,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
}}/>
|
||||||
|
</Dialog.Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditItem = (item, index) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity onPress={() => {
|
||||||
|
this.setState({displayModalHistory: true, historyItemDetail: item})
|
||||||
|
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
|
||||||
|
{
|
||||||
|
Object.keys(omit(item, ['id', 'id_epargne', 'duree_mois', 'date_fin', 'interet', 'taxe'])).map((element, i) => (
|
||||||
|
<View style={{alignItems: 'center'}} key={i}>
|
||||||
|
|
||||||
|
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
|
||||||
|
{
|
||||||
|
isEqual(element, 'montant') ?
|
||||||
|
` ${thousands(item[element], ' ')}`
|
||||||
|
: isEqual(element, 'date_creation') ?
|
||||||
|
cutStringWithoutDot(item[element], 16)
|
||||||
|
: item[element]
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditList = () => {
|
||||||
|
const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props;
|
||||||
|
if (errorNanoCreditHistory !== null) {
|
||||||
|
if (typeof errorNanoCreditHistory.data !== 'undefined') {
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
<Text style={Typography.body1}>{errorNanoCreditHistory.data.error}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
<Text style={Typography.body1}>{errorNanoCreditHistory}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (resultNanoCreditHistory !== null) {
|
||||||
|
if (resultNanoCreditHistory.response !== null) {
|
||||||
|
return (
|
||||||
|
Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
|
||||||
|
{
|
||||||
|
nanoCreditHistoryLabel().map((item, index) => (
|
||||||
|
<View style={{alignItems: 'center'}} key={index}>
|
||||||
|
<Icon name={item.icon} size={24} color={Color.primaryColor}/>
|
||||||
|
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
|
||||||
|
{I18n.t(item.label)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
resultNanoCreditHistory.response.map((item, index) => (
|
||||||
|
this.renderNanoCreditItem(item, index)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
(
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
|
||||||
|
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditHistory = () => {
|
||||||
|
return (
|
||||||
|
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
|
||||||
|
|
||||||
|
{
|
||||||
|
this.props.loadingNanoCreditHistory ?
|
||||||
|
(
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
{Platform.OS === 'android'
|
||||||
|
?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<ProgressBarAndroid/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
<>
|
||||||
|
<ActivityIndicator size="large" color={'#ccc'}/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
) : this.renderNanoCreditList()
|
||||||
|
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
|
||||||
|
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
|
||||||
|
{this.state.displayPasswordModal && this.renderPasswordDialog()}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.title3, Typography.semibold]}>
|
||||||
|
{I18n.t('NANO_CREDIT_LIST')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{
|
||||||
|
this.renderNanoCreditHistory()
|
||||||
|
}
|
||||||
|
{/* <Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.idDemandAnim = comp
|
||||||
|
}}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
||||||
|
label={I18n.t('ID_DEMAND')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.idDemand}
|
||||||
|
onChangeText={(idDemand) => {
|
||||||
|
|
||||||
|
this.setState({idDemand})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.passwordAnim = comp
|
||||||
|
}}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({password})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
onPress={() => {
|
||||||
|
this.onSubmitRefundNanoCredit();
|
||||||
|
}}>
|
||||||
|
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
|
loading: state.refundCreditDemandReducer.loading,
|
||||||
|
result: state.refundCreditDemandReducer.result,
|
||||||
|
error: state.refundCreditDemandReducer.error,
|
||||||
|
|
||||||
|
loadingNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.loading,
|
||||||
|
resultNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.result,
|
||||||
|
errorNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
|
refundCreditDemandUserAction,
|
||||||
|
refundCreditDemandUserReset,
|
||||||
|
getNanoCreditUserHistoryInProgressAction,
|
||||||
|
getNanoCreditUserHistoryInProgressReset
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUser);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.containerBackgroundColor,
|
||||||
|
paddingHorizontal: 20
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
blockView: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 1
|
||||||
|
},
|
||||||
|
subbigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 17,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
btnvalide: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52
|
||||||
|
},
|
||||||
|
btnSubmit: {
|
||||||
|
marginTop: 20,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
backgroundColor: Color.accentLightColor,
|
||||||
|
height: 52,
|
||||||
|
width: "30%",
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
height: 60,
|
||||||
|
marginTop: responsiveHeight(2),
|
||||||
|
marginLeft: responsiveWidth(5),
|
||||||
|
marginRight: responsiveWidth(5),
|
||||||
|
borderRadius: 5,
|
||||||
|
},
|
||||||
|
circlePoint: {
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
borderRadius: 25,
|
||||||
|
marginRight: 5,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
checkDefault: {
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
paddingVertical: 10,
|
||||||
|
marginTop: 5
|
||||||
|
},
|
||||||
|
transactionContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
paddingTop: 10,
|
||||||
|
},
|
||||||
|
containerTouch: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
shadowColor: Color.borderColor,
|
||||||
|
borderColor: Color.borderColor,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
shadowOffset: {width: 1.5, height: 1.5},
|
||||||
|
shadowOpacity: 1.0,
|
||||||
|
elevation: 5,
|
||||||
|
borderRadius: 10,
|
||||||
|
backgroundColor: Color.cardBackgroundColor
|
||||||
|
},
|
||||||
|
|
||||||
|
contain: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
imageBanner: {
|
||||||
|
marginTop: 15,
|
||||||
|
marginLeft: 5,
|
||||||
|
width: Utils.scaleWithPixel(30),
|
||||||
|
height: Utils.scaleWithPixel(30)
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
height: Utils.scaleWithPixel(65),
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
contentTitle: {
|
||||||
|
paddingTop: 12,
|
||||||
|
},
|
||||||
|
contentService: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 0.5,
|
||||||
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
containField: {
|
||||||
|
padding: 10,
|
||||||
|
marginBottom: 20,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
shadowOffset: {width: 1.5, height: 1.5},
|
||||||
|
shadowOpacity: 1.0,
|
||||||
|
elevation: 5,
|
||||||
|
flexDirection: "row",
|
||||||
|
height: 140,
|
||||||
|
borderRadius: 10
|
||||||
|
},
|
||||||
|
paymentItem: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
paddingVertical: 5,
|
||||||
|
width: responsiveWidth(100),
|
||||||
|
marginBottom: 15
|
||||||
|
},
|
||||||
|
iconContent: {
|
||||||
|
width: 60,
|
||||||
|
marginRight: 10,
|
||||||
|
alignItems: "center"
|
||||||
|
},
|
||||||
|
contentLeftItem: {
|
||||||
|
flex: 1,
|
||||||
|
paddingTop: 40,
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 10,
|
||||||
|
alignItems: "center"
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,24 +1,38 @@
|
||||||
import Button from 'apsl-react-native-button';
|
|
||||||
import isEqual from 'lodash/isEqual';
|
import isEqual from 'lodash/isEqual';
|
||||||
import isNil from 'lodash/isNil';
|
import isNil from 'lodash/isNil';
|
||||||
import React, { Component } from 'react';
|
import React, {Component} from 'react';
|
||||||
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
|
import {
|
||||||
import * as Animatable from 'react-native-animatable';
|
ActivityIndicator,
|
||||||
|
Alert,
|
||||||
|
Platform,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View
|
||||||
|
} from 'react-native';
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
import { ProgressDialog } from 'react-native-simple-dialogs';
|
import {ProgressDialog} from 'react-native-simple-dialogs';
|
||||||
import { Fumi } from 'react-native-textinput-effects';
|
import {connect} from 'react-redux';
|
||||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
import omit from 'lodash/omit';
|
||||||
import { connect } from 'react-redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import {Color} from '../../config/Color';
|
||||||
import { Color } from '../../config/Color';
|
import {IlinkEmitter} from '../../utils/events';
|
||||||
import { FontWeight, Typography } from '../../config/typography';
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
import { store } from "../../redux/store";
|
import {refundCreditDemandUserAction, refundCreditDemandUserReset} from '../../webservice/user/NanoCreditApi';
|
||||||
import { IlinkEmitter } from '../../utils/events';
|
import {
|
||||||
import { readUser } from '../../webservice/AuthApi';
|
getNanoCreditUserHistoryInProgressAction,
|
||||||
import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi';
|
getNanoCreditUserHistoryInProgressReset,
|
||||||
import { isNormalInteger } from '../../utils/UtilsFunction';
|
} from "../../webservice/NanoCreditApi";
|
||||||
import { refundCreditDemandUserAction, refundCreditDemandUserReset } from '../../webservice/user/NanoCreditApi';
|
import {Typography} from "../../config/typography";
|
||||||
|
import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
|
||||||
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import thousands from "thousands";
|
||||||
|
import * as Utils from "../../utils/DeviceUtils";
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
|
||||||
let theme = require('../../utils/theme.json');
|
let theme = require('../../utils/theme.json');
|
||||||
let route = require('../../route.json');
|
let route = require('../../route.json');
|
||||||
|
|
||||||
|
@ -26,261 +40,703 @@ let route = require('../../route.json');
|
||||||
class RefundNanoCreditUser extends Component {
|
class RefundNanoCreditUser extends Component {
|
||||||
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
password: null,
|
password: null,
|
||||||
idDemand: null,
|
idDemand: null,
|
||||||
codeGroup: null,
|
codeGroup: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
user: null,
|
user: null,
|
||||||
triggerSubmitClick: false,
|
triggerSubmitClick: false,
|
||||||
isSubmitClick: false,
|
isSubmitClick: false,
|
||||||
isDataSubmit: false,
|
isDataSubmit: false,
|
||||||
isModalConfirmVisible: false,
|
isModalConfirmVisible: false,
|
||||||
isGroupToModify: false,
|
isGroupToModify: false,
|
||||||
};
|
displayModalHistory: false,
|
||||||
|
historyItemDetail: null,
|
||||||
|
isDataHasLoaded: false,
|
||||||
|
displayPasswordModal: false,
|
||||||
|
wallet: this.props.navigation.state.params.wallet,
|
||||||
|
|
||||||
}
|
};
|
||||||
|
this.props.getNanoCreditUserHistoryInProgressReset();
|
||||||
|
|
||||||
static navigatorStyle = {
|
}
|
||||||
navBarBackgroundColor: Color.primaryColor,
|
|
||||||
statusBarColor: Color.primaryDarkColor,
|
|
||||||
navBarTextColor: '#FFFFFF',
|
|
||||||
navBarButtonColor: '#FFFFFF'
|
|
||||||
|
|
||||||
};
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
static navigationOptions = () => {
|
};
|
||||||
return {
|
|
||||||
drawerLabel: () => null,
|
|
||||||
headerTitle: I18n.t('REFUND_NANO_CREDIT'),
|
|
||||||
headerTintColor: 'white',
|
|
||||||
headerStyle: {
|
|
||||||
backgroundColor: Color.primaryColor,
|
|
||||||
marginTop: 0,
|
|
||||||
color: 'white'
|
|
||||||
},
|
|
||||||
headerTitleStyle: {
|
|
||||||
color: "white"
|
|
||||||
},
|
|
||||||
title: I18n.t('REFUND_NANO_CREDIT')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount() {
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('REFUND_NANO_CREDIT'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('REFUND_NANO_CREDIT')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
readUser().then((user) => {
|
componentDidMount() {
|
||||||
if (user) {
|
|
||||||
if (user !== undefined) {
|
|
||||||
this.setState({ user });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({user});
|
||||||
|
this.props.getNanoCreditUserHistoryInProgressAction(user.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ckeckIfFieldIsOK(champ) {
|
}
|
||||||
return (isNil(champ) || isEqual(champ.length, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
renderRefundNanoCreditResponse = () => {
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
const { result, error } = this.props;
|
renderRefundNanoCreditResponse = () => {
|
||||||
|
|
||||||
if (error !== null) {
|
const {result, error} = this.props;
|
||||||
if (typeof error.data !== 'undefined') {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t("ERROR_LABLE"),
|
|
||||||
error.data.error,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: I18n.t("OK"), onPress: () => {
|
|
||||||
this.props.refundCreditDemandUserReset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
{ cancelable: false }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result !== null) {
|
if (error !== null) {
|
||||||
if (result.response !== null) {
|
if (typeof error.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("REFUND_DONE"),
|
I18n.t("ERROR_LABLE"),
|
||||||
result.response,
|
error.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t("OK"), onPress: () => {
|
||||||
this.props.refundCreditDemandUserReset();
|
this.props.refundCreditDemandUserReset();
|
||||||
IlinkEmitter.emit("refreshWallet");
|
}
|
||||||
this.props.navigation.pop();
|
}
|
||||||
}
|
],
|
||||||
}
|
{cancelable: false}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
],
|
if (result !== null) {
|
||||||
{ cancelable: false }
|
if (result.response !== null) {
|
||||||
)
|
Alert.alert(
|
||||||
}
|
I18n.t("REFUND_DONE"),
|
||||||
}
|
result.response,
|
||||||
}
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.refundCreditDemandUserReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
IlinkEmitter.emit("updateNanoCreditAccount");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateLangue() {
|
],
|
||||||
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') })
|
{cancelable: false}
|
||||||
this.forceUpdate()
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ckeckIfFieldIsOK(champ) {
|
updateLangue() {
|
||||||
return (isNil(champ) || isEqual(champ.length, 0));
|
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
|
||||||
}
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
onSubmitRefundNanoCredit = () => {
|
ckeckIfFieldIsOK(champ) {
|
||||||
const { idDemand, password } = this.state;
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ckeckIfFieldIsOK(idDemand))
|
onSubmitRefundNanoCredit = () => {
|
||||||
this.idDemandAnim.shake(800);
|
const {idDemand, password} = this.state;
|
||||||
else if (this.ckeckIfFieldIsOK(password))
|
|
||||||
this.passwordAnim.shake(800);
|
|
||||||
else {
|
|
||||||
|
|
||||||
this.props.refundCreditDemandUserAction({
|
if (this.ckeckIfFieldIsOK(idDemand))
|
||||||
id_user: this.state.user.id,
|
this.idDemandAnim.shake(800);
|
||||||
id_demande: this.state.idDemand,
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
password: this.state.password
|
this.passwordAnim.shake(800);
|
||||||
}, 0);
|
else {
|
||||||
}
|
|
||||||
this.setState({
|
this.props.refundCreditDemandUserAction({
|
||||||
isDataSubmit: true
|
id_user: this.state.user.id,
|
||||||
});
|
id_demande: this.state.idDemand,
|
||||||
}
|
password: this.state.password
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
renderLoader = () => {
|
renderLoader = () => {
|
||||||
return (
|
return (
|
||||||
<ProgressDialog
|
<ProgressDialog
|
||||||
visible={this.props.loading || this.props.loadingGetCommission}
|
visible={this.props.loading || this.props.loadingGetCommission}
|
||||||
title={I18n.t('LOADING')}
|
title={I18n.t('LOADING')}
|
||||||
message={I18n.t('LOADING_INFO')}
|
message={I18n.t('LOADING_INFO')}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
renderModalHistoryDetail = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
|
|
||||||
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
|
|
||||||
<ScrollView style={styles.container}>
|
|
||||||
|
|
||||||
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
|
<Dialog.Container useNativeDriver={true} visible={this.state.displayModalHistory}>
|
||||||
|
|
||||||
<Animatable.View ref={(comp) => { this.idDemandAnim = comp }}>
|
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
{
|
||||||
label={I18n.t('ID_DEMAND')}
|
<ScrollView persistentScrollbar={true}>
|
||||||
iconColor={'#f95a25'}
|
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
|
||||||
iconSize={20}
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
value={this.state.idDemand}
|
<View style={{flex: 1}}>
|
||||||
onChangeText={(idDemand) => {
|
<Text style={[styles.body2]}>Type</Text>
|
||||||
|
</View>
|
||||||
this.setState({ idDemand })
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
}}
|
<Text
|
||||||
style={styles.input}
|
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
|
||||||
>
|
</View>
|
||||||
</Fumi>
|
</View>
|
||||||
</Animatable.View>
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
|
||||||
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
|
</View>
|
||||||
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
label={I18n.t('PASSWORD')}
|
<Text
|
||||||
iconColor={'#f95a25'}
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text>
|
||||||
iconSize={20}
|
</View>
|
||||||
secureTextEntry={true}
|
</View>
|
||||||
value={this.state.password}
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
onChangeText={(password) => {
|
<View style={{flex: 1}}>
|
||||||
this.setState({ password })
|
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
|
||||||
}}
|
</View>
|
||||||
style={styles.input}
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
>
|
<Text
|
||||||
</Fumi>
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
|
||||||
</Animatable.View>
|
</View>
|
||||||
|
</View>
|
||||||
<Button style={styles.btnvalide}
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
textStyle={styles.textbtnvalide}
|
<View style={{flex: 1}}>
|
||||||
onPress={() => { this.onSubmitRefundNanoCredit(); }}>
|
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
|
||||||
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash == 1 ? I18n.t('YES') : I18n.t('NO')}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('VALIDATION_DATE')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_validation}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{flexDirection: 'row', marginTop: 10}}>
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{flex: 1, alignItems: 'flex-end'}}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</>
|
|
||||||
)
|
}
|
||||||
}
|
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
displayModalHistory: !this.state.displayModalHistory,
|
||||||
|
});
|
||||||
|
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
displayPasswordModal: !this.state.displayPasswordModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
</Dialog.Container>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderPasswordDialog = () => {
|
||||||
|
return (
|
||||||
|
<Dialog.Container useNativeDriver={true} visible={this.state.displayPasswordModal}>
|
||||||
|
|
||||||
|
<Dialog.Title>{I18n.t('PASSWORD')}</Dialog.Title>
|
||||||
|
|
||||||
|
<Dialog.Input placeholder={I18n.t('PLEASE_ENTER_THE_PASSWORD')}
|
||||||
|
style={{borderBottomWidth: 1, borderBottomColor: Color.borderColor}}
|
||||||
|
showSoftInputOnFocus={true}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({password})
|
||||||
|
}}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onSubmitEditing={() => {
|
||||||
|
this.setState({
|
||||||
|
displayPasswordModal: false,
|
||||||
|
displayModalHistory: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
this.props.refundCreditDemandUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
id_demande: this.state.historyItemDetail.id_demande,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
}}/>
|
||||||
|
|
||||||
|
<Dialog.Button label={I18n.t('CANCEL_LABEL')} onPress={() => {
|
||||||
|
this.setState({displayPasswordModal: !this.state.displayPasswordModal});
|
||||||
|
}}/>
|
||||||
|
<Dialog.Button label={I18n.t('SUBMIT_LABEL')} onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
displayPasswordModal: false,
|
||||||
|
displayModalHistory: false,
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
this.props.refundCreditDemandUserAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
id_demande: this.state.historyItemDetail.id_demande,
|
||||||
|
password: this.state.password
|
||||||
|
});
|
||||||
|
}}/>
|
||||||
|
</Dialog.Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditItem = (item, index) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity onPress={() => {
|
||||||
|
this.setState({displayModalHistory: true, historyItemDetail: item})
|
||||||
|
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
|
||||||
|
{
|
||||||
|
Object.keys(omit(item, ['id', 'id_demande', 'agent', 'retrait_cash', 'date_remboursement_prevu', 'taxe', 'date_validation', 'duree_mois', 'interet', 'montant_rembourse', 'partiellement_rembourse',])).map((element, i) => (
|
||||||
|
<View style={{alignItems: 'center'}} key={i}>
|
||||||
|
|
||||||
|
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
|
||||||
|
{
|
||||||
|
isEqual(element, 'montant') ?
|
||||||
|
` ${thousands(item[element], ' ')}`
|
||||||
|
: isEqual(element, 'date_creation') ?
|
||||||
|
cutStringWithoutDot(item[element], 16)
|
||||||
|
: item[element]
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditList = () => {
|
||||||
|
const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props;
|
||||||
|
if (errorNanoCreditHistory !== null) {
|
||||||
|
if (typeof errorNanoCreditHistory.data !== 'undefined') {
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
<Text style={Typography.body1}>{errorNanoCreditHistory.data.error}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
<Text style={Typography.body1}>{errorNanoCreditHistory}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (resultNanoCreditHistory !== null) {
|
||||||
|
if (resultNanoCreditHistory.response !== null) {
|
||||||
|
return (
|
||||||
|
Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
|
||||||
|
{
|
||||||
|
nanoCreditHistoryLabel().map((item, index) => (
|
||||||
|
<View style={{alignItems: 'center'}} key={index}>
|
||||||
|
<Icon name={item.icon} size={24} color={Color.primaryColor}/>
|
||||||
|
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
|
||||||
|
{I18n.t(item.label)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
resultNanoCreditHistory.response.map((item, index) => (
|
||||||
|
this.renderNanoCreditItem(item, index)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
(
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
|
||||||
|
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNanoCreditHistory = () => {
|
||||||
|
return (
|
||||||
|
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
|
||||||
|
|
||||||
|
{
|
||||||
|
this.props.loadingNanoCreditHistory ?
|
||||||
|
(
|
||||||
|
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||||
|
{Platform.OS === 'android'
|
||||||
|
?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<ProgressBarAndroid/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
<>
|
||||||
|
<ActivityIndicator size="large" color={'#ccc'}/>
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
) : this.renderNanoCreditList()
|
||||||
|
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
|
||||||
|
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
|
||||||
|
{this.state.displayPasswordModal && this.renderPasswordDialog()}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
|
||||||
|
<Text
|
||||||
|
style={[Typography.title3, Typography.semibold]}>
|
||||||
|
{I18n.t('NANO_CREDIT_LIST')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{
|
||||||
|
this.renderNanoCreditHistory()
|
||||||
|
}
|
||||||
|
{/* <Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.idDemandAnim = comp
|
||||||
|
}}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
||||||
|
label={I18n.t('ID_DEMAND')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.idDemand}
|
||||||
|
onChangeText={(idDemand) => {
|
||||||
|
|
||||||
|
this.setState({idDemand})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => {
|
||||||
|
this.passwordAnim = comp
|
||||||
|
}}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
|
||||||
|
label={I18n.t('PASSWORD')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
secureTextEntry={true}
|
||||||
|
value={this.state.password}
|
||||||
|
onChangeText={(password) => {
|
||||||
|
this.setState({password})
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
onPress={() => {
|
||||||
|
this.onSubmitRefundNanoCredit();
|
||||||
|
}}>
|
||||||
|
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const maptStateToProps = state => ({
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
loading: state.refundCreditDemandReducer.loading,
|
loading: state.refundCreditDemandReducer.loading,
|
||||||
result: state.refundCreditDemandReducer.result,
|
result: state.refundCreditDemandReducer.result,
|
||||||
error: state.refundCreditDemandReducer.error,
|
error: state.refundCreditDemandReducer.error,
|
||||||
|
|
||||||
|
loadingNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.loading,
|
||||||
|
resultNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.result,
|
||||||
|
errorNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.error,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
refundCreditDemandUserAction,
|
refundCreditDemandUserAction,
|
||||||
refundCreditDemandUserReset,
|
refundCreditDemandUserReset,
|
||||||
|
getNanoCreditUserHistoryInProgressAction,
|
||||||
|
getNanoCreditUserHistoryInProgressReset
|
||||||
|
|
||||||
}, dispatch);
|
}, dispatch);
|
||||||
|
|
||||||
export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUser);
|
export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUser);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: Color.primaryDarkColor,
|
backgroundColor: Color.containerBackgroundColor,
|
||||||
},
|
paddingHorizontal: 20
|
||||||
textbtnvalide: {
|
},
|
||||||
color: 'white',
|
textbtnvalide: {
|
||||||
fontWeight: 'bold'
|
color: 'white',
|
||||||
},
|
fontWeight: 'bold'
|
||||||
bigtitle: {
|
},
|
||||||
color: 'white',
|
bigtitle: {
|
||||||
fontSize: 20,
|
color: 'white',
|
||||||
flex: 1,
|
fontSize: 20,
|
||||||
fontWeight: 'bold',
|
flex: 1,
|
||||||
textAlign: 'center',
|
fontWeight: 'bold',
|
||||||
margin: 20,
|
textAlign: 'center',
|
||||||
},
|
margin: 20,
|
||||||
blockView: {
|
},
|
||||||
paddingVertical: 10,
|
blockView: {
|
||||||
borderBottomWidth: 1
|
paddingVertical: 10,
|
||||||
},
|
borderBottomWidth: 1
|
||||||
subbigtitle: {
|
},
|
||||||
color: 'white',
|
subbigtitle: {
|
||||||
fontSize: 17,
|
color: 'white',
|
||||||
textAlign: 'center',
|
fontSize: 17,
|
||||||
margin: 5,
|
textAlign: 'center',
|
||||||
},
|
margin: 5,
|
||||||
btnvalide: {
|
},
|
||||||
marginTop: 20,
|
btnvalide: {
|
||||||
marginLeft: 20,
|
marginTop: 20,
|
||||||
marginRight: 20,
|
marginLeft: 20,
|
||||||
borderColor: 'transparent',
|
marginRight: 20,
|
||||||
backgroundColor: Color.accentLightColor,
|
borderColor: 'transparent',
|
||||||
height: 52
|
backgroundColor: Color.accentLightColor,
|
||||||
},
|
height: 52
|
||||||
btnSubmit: {
|
},
|
||||||
marginTop: 20,
|
btnSubmit: {
|
||||||
borderColor: 'transparent',
|
marginTop: 20,
|
||||||
backgroundColor: Color.accentLightColor,
|
borderColor: 'transparent',
|
||||||
height: 52,
|
backgroundColor: Color.accentLightColor,
|
||||||
width: "30%",
|
height: 52,
|
||||||
marginLeft: 20,
|
width: "30%",
|
||||||
marginRight: 20,
|
marginLeft: 20,
|
||||||
},
|
marginRight: 20,
|
||||||
input: {
|
},
|
||||||
height: 60,
|
input: {
|
||||||
marginTop: responsiveHeight(2),
|
height: 60,
|
||||||
marginLeft: responsiveWidth(5),
|
marginTop: responsiveHeight(2),
|
||||||
marginRight: responsiveWidth(5),
|
marginLeft: responsiveWidth(5),
|
||||||
borderRadius: 5,
|
marginRight: responsiveWidth(5),
|
||||||
}
|
borderRadius: 5,
|
||||||
|
},
|
||||||
|
circlePoint: {
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
borderRadius: 25,
|
||||||
|
marginRight: 5,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
checkDefault: {
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
paddingVertical: 10,
|
||||||
|
marginTop: 5
|
||||||
|
},
|
||||||
|
transactionContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
paddingTop: 10,
|
||||||
|
},
|
||||||
|
containerTouch: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
shadowColor: Color.borderColor,
|
||||||
|
borderColor: Color.borderColor,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
shadowOffset: {width: 1.5, height: 1.5},
|
||||||
|
shadowOpacity: 1.0,
|
||||||
|
elevation: 5,
|
||||||
|
borderRadius: 10,
|
||||||
|
backgroundColor: Color.cardBackgroundColor
|
||||||
|
},
|
||||||
|
|
||||||
|
contain: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
imageBanner: {
|
||||||
|
marginTop: 15,
|
||||||
|
marginLeft: 5,
|
||||||
|
width: Utils.scaleWithPixel(30),
|
||||||
|
height: Utils.scaleWithPixel(30)
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
height: Utils.scaleWithPixel(65),
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
contentTitle: {
|
||||||
|
paddingTop: 12,
|
||||||
|
},
|
||||||
|
contentService: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
borderBottomWidth: 0.5,
|
||||||
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
containField: {
|
||||||
|
padding: 10,
|
||||||
|
marginBottom: 20,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
shadowOffset: {width: 1.5, height: 1.5},
|
||||||
|
shadowOpacity: 1.0,
|
||||||
|
elevation: 5,
|
||||||
|
flexDirection: "row",
|
||||||
|
height: 140,
|
||||||
|
borderRadius: 10
|
||||||
|
},
|
||||||
|
paymentItem: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
paddingVertical: 5,
|
||||||
|
width: responsiveWidth(100),
|
||||||
|
marginBottom: 15
|
||||||
|
},
|
||||||
|
iconContent: {
|
||||||
|
width: 60,
|
||||||
|
marginRight: 10,
|
||||||
|
alignItems: "center"
|
||||||
|
},
|
||||||
|
contentLeftItem: {
|
||||||
|
flex: 1,
|
||||||
|
paddingTop: 40,
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 10,
|
||||||
|
alignItems: "center"
|
||||||
|
},
|
||||||
});
|
});
|
File diff suppressed because it is too large
Load Diff
|
@ -120,9 +120,9 @@ class OperateurOptionSelect extends Component {
|
||||||
}}>
|
}}>
|
||||||
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={Typography.body1}>{item.bank_name}</Text>
|
<Text style={Typography.body1}>{item.operator_name}</Text>
|
||||||
<Text style={[Typography.footnote, Color.grayColor]} style={{marginTop: 5}}>
|
<Text style={[Typography.footnote, Color.grayColor]} style={{marginTop: 5}}>
|
||||||
{I18n.t('COUNTRY')}: {item.country}
|
{I18n.t('COUNTRY')}: {`${item.operator_address}, ${item.country}`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -177,7 +177,10 @@ class OperateurOptionSelect extends Component {
|
||||||
key={index}
|
key={index}
|
||||||
style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]}
|
style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
|
this.props.navigation.navigate(item.screen, {
|
||||||
|
type: item.type,
|
||||||
|
title: item.title
|
||||||
|
})
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -285,7 +285,7 @@ class EnvoieWalletToBankAgent extends Component {
|
||||||
id_wallet_agent: this.state.wallet.id,
|
id_wallet_agent: this.state.wallet.id,
|
||||||
id_wallet_network: this.state.wallet.id_network,
|
id_wallet_network: this.state.wallet.id_network,
|
||||||
iban: codeIban,
|
iban: codeIban,
|
||||||
id_bank: this.state.bank.id_bank,
|
id_bank: this.state.bank.id_operator,
|
||||||
montant: montant,
|
montant: montant,
|
||||||
password: password
|
password: password
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,26 @@ export const transactionHistoryIlinkLabel = () => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
export const nanoCreditHistoryLabel = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
icon: 'arrow-expand',
|
||||||
|
label: 'HISTORY_TYPE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'inbox-arrow-up',
|
||||||
|
label: 'ETAT'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'cash',
|
||||||
|
label: 'AMOUNT_LABEL'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'calendar-clock',
|
||||||
|
label: 'DATE'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
export const transactionHistoryNanoCreditLabel = () => {
|
export const transactionHistoryNanoCreditLabel = () => {
|
||||||
return [
|
return [
|
||||||
/*{
|
/*{
|
||||||
|
|
|
@ -155,6 +155,8 @@
|
||||||
"DEPOSIT_TO_CARD": "Your Wallet to card",
|
"DEPOSIT_TO_CARD": "Your Wallet to card",
|
||||||
"DEPOSIT_TO_BANK": "Your Wallet to bank",
|
"DEPOSIT_TO_BANK": "Your Wallet to bank",
|
||||||
"NANO_CREDIT": "Nano credit",
|
"NANO_CREDIT": "Nano credit",
|
||||||
|
"NANO_CREDIT_LIST": "Nano credit list",
|
||||||
|
"NO_NANO_CREDIT": "No nano credit demand",
|
||||||
"NANO_CREDIT_DESCRIPTION": "Nano credit description",
|
"NANO_CREDIT_DESCRIPTION": "Nano credit description",
|
||||||
"NANO_SANTE": "Nano health",
|
"NANO_SANTE": "Nano health",
|
||||||
"NANO_SANTE_DESCRIPTION": "Nano health description",
|
"NANO_SANTE_DESCRIPTION": "Nano health description",
|
||||||
|
@ -165,6 +167,7 @@
|
||||||
"SAVE_MONEY": "Save money",
|
"SAVE_MONEY": "Save money",
|
||||||
"SAVE_MONEY_TYPE": "Savings type",
|
"SAVE_MONEY_TYPE": "Savings type",
|
||||||
"CAUTION_CREDIT": "Caution credit demand",
|
"CAUTION_CREDIT": "Caution credit demand",
|
||||||
|
"CAUTIONNEMENT_DONE": "Caution done",
|
||||||
"ID_DEMAND": "Demand ID",
|
"ID_DEMAND": "Demand ID",
|
||||||
"DATE": "Date",
|
"DATE": "Date",
|
||||||
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",
|
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",
|
||||||
|
|
|
@ -162,6 +162,8 @@
|
||||||
"DEPOSIT_TO_CARD": "Votre Wallet vers carte",
|
"DEPOSIT_TO_CARD": "Votre Wallet vers carte",
|
||||||
"DEPOSIT_TO_BANK": "Votre Wallet vers banque",
|
"DEPOSIT_TO_BANK": "Votre Wallet vers banque",
|
||||||
"NANO_CREDIT": "Nano crédit",
|
"NANO_CREDIT": "Nano crédit",
|
||||||
|
"NANO_CREDIT_LIST": "Liste des nano crédit",
|
||||||
|
"NO_NANO_CREDIT": "Aucune demande de nano crédit",
|
||||||
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
|
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
|
||||||
"NANO_SANTE": "Nano santé",
|
"NANO_SANTE": "Nano santé",
|
||||||
"NANO_SANTE_DESCRIPTION": "Nano santé iLink",
|
"NANO_SANTE_DESCRIPTION": "Nano santé iLink",
|
||||||
|
@ -172,6 +174,7 @@
|
||||||
"SAVE_MONEY_TYPE": "Type d'épargne",
|
"SAVE_MONEY_TYPE": "Type d'épargne",
|
||||||
"REFUND_DONE": "Remboursement effectué",
|
"REFUND_DONE": "Remboursement effectué",
|
||||||
"CAUTION_CREDIT": "Cautionner une demande de crédit",
|
"CAUTION_CREDIT": "Cautionner une demande de crédit",
|
||||||
|
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
|
||||||
"ID_DEMAND": "Identifiant de la demande",
|
"ID_DEMAND": "Identifiant de la demande",
|
||||||
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
|
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
|
||||||
"PAIEMENT_ECOLE": "Paiement école",
|
"PAIEMENT_ECOLE": "Paiement école",
|
||||||
|
|
|
@ -69,7 +69,9 @@ export const getNanoCreditAccount = testBaseUrl + '/walletService/groups/nanoCre
|
||||||
export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands';
|
export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands';
|
||||||
export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands';
|
export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands';
|
||||||
export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history';
|
export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history';
|
||||||
export const getBankUrl = testBaseUrl + '/walletService/wallets/users/banks';
|
export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank';
|
||||||
|
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
|
||||||
|
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress';
|
||||||
|
|
||||||
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
||||||
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
||||||
|
|
|
@ -1,9 +1,45 @@
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { fetchCreateGroupError, fetchCreateGroupPending, fetchCreateGroupReset, fetchCreateGroupSuccess, fetchTreatDemandsGroupPending, fetchTreatDemandsGroupSuccess, fetchTreatDemandsGroupError, fetchTreatDemandsGroupReset, fetchJoinGroupPending, fetchJoinGroupSuccess, fetchJoinGroupError, fetchJoinGroupReset, fetchAskNanoCreditPending, fetchAskNanoCreditSuccess, fetchAskNanoCreditError, fetchAskNanoCreditReset, fetchGetNanoCreditDemandDurationPending, fetchGetNanoCreditDemandDurationSuccess, fetchGetNanoCreditDemandDurationError, fetchGetNanoCreditDemandDurationReset } from "../redux/actions/NanoCreditAction";
|
import {
|
||||||
import { store } from "../redux/store";
|
fetchAskNanoCreditError,
|
||||||
import { groupUrl, getNanoCreditDemandDureationUrl, treatDemandUrl, joinGroupUrl, cancelDemandUrl, askNanoCreditUrl } from "./IlinkConstants";
|
fetchAskNanoCreditPending,
|
||||||
|
fetchAskNanoCreditReset,
|
||||||
|
fetchAskNanoCreditSuccess,
|
||||||
|
fetchCreateGroupError,
|
||||||
|
fetchCreateGroupPending,
|
||||||
|
fetchCreateGroupReset,
|
||||||
|
fetchCreateGroupSuccess,
|
||||||
|
fetchGetEpargneInProgressError,
|
||||||
|
fetchGetEpargneInProgressPending,
|
||||||
|
fetchGetEpargneInProgressReset,
|
||||||
|
fetchGetEpargneInProgressSuccess,
|
||||||
|
fetchGetNanoCreditDemandDurationError,
|
||||||
|
fetchGetNanoCreditDemandDurationPending,
|
||||||
|
fetchGetNanoCreditDemandDurationReset,
|
||||||
|
fetchGetNanoCreditDemandDurationSuccess,
|
||||||
|
fetchGetNanoCreditUserHistoryInProgressError,
|
||||||
|
fetchGetNanoCreditUserHistoryInProgressPending,
|
||||||
|
fetchGetNanoCreditUserHistoryInProgressReset,
|
||||||
|
fetchGetNanoCreditUserHistoryInProgressSuccess,
|
||||||
|
fetchJoinGroupError,
|
||||||
|
fetchJoinGroupPending,
|
||||||
|
fetchJoinGroupReset,
|
||||||
|
fetchJoinGroupSuccess,
|
||||||
|
fetchTreatDemandsGroupError,
|
||||||
|
fetchTreatDemandsGroupPending,
|
||||||
|
fetchTreatDemandsGroupReset,
|
||||||
|
fetchTreatDemandsGroupSuccess
|
||||||
|
} from "../redux/actions/NanoCreditAction";
|
||||||
|
import {store} from "../redux/store";
|
||||||
|
import {
|
||||||
|
askNanoCreditUrl,
|
||||||
|
cancelDemandUrl,
|
||||||
|
getHistoryNanoPendingCreditUrl,
|
||||||
|
getNanoCreditDemandDureationUrl,
|
||||||
|
groupUrl,
|
||||||
|
joinGroupUrl,
|
||||||
|
treatDemandUrl
|
||||||
|
} from "./IlinkConstants";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -13,225 +49,301 @@ import { groupUrl, getNanoCreditDemandDureationUrl, treatDemandUrl, joinGroupUrl
|
||||||
export const createGroupAction = (data, isToMofidy) => {
|
export const createGroupAction = (data, isToMofidy) => {
|
||||||
|
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchCreateGroupPending());
|
dispatch(fetchCreateGroupPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${groupUrl}`,
|
url: `${groupUrl}`,
|
||||||
method: isToMofidy === 0 ?
|
method: isToMofidy === 0 ?
|
||||||
'POST' :
|
'POST' :
|
||||||
isToMofidy === 1 ? 'PUT' : 'DELETE',
|
isToMofidy === 1 ? 'PUT' : 'DELETE',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchCreateGroupSuccess(response));
|
dispatch(fetchCreateGroupSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchCreateGroupError(error.response));
|
dispatch(fetchCreateGroupError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchCreateGroupError(error.request))
|
dispatch(fetchCreateGroupError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchCreateGroupError(error.message))
|
dispatch(fetchCreateGroupError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createGroupReset = () => {
|
export const createGroupReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchCreateGroupReset());
|
dispatch(fetchCreateGroupReset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const treatDemandGroupAction = (data) => {
|
export const treatDemandGroupAction = (data) => {
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchTreatDemandsGroupPending());
|
dispatch(fetchTreatDemandsGroupPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${treatDemandUrl}`,
|
url: `${treatDemandUrl}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchTreatDemandsGroupSuccess(response));
|
dispatch(fetchTreatDemandsGroupSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchTreatDemandsGroupError(error.response));
|
dispatch(fetchTreatDemandsGroupError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchTreatDemandsGroupError(error.request))
|
dispatch(fetchTreatDemandsGroupError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchTreatDemandsGroupError(error.message))
|
dispatch(fetchTreatDemandsGroupError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cancelDemandGroupAction = (data) => {
|
export const cancelDemandGroupAction = (data) => {
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchTreatDemandsGroupPending());
|
dispatch(fetchTreatDemandsGroupPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${cancelDemandUrl}`,
|
url: `${cancelDemandUrl}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchTreatDemandsGroupSuccess(response));
|
dispatch(fetchTreatDemandsGroupSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchTreatDemandsGroupError(error.response));
|
dispatch(fetchTreatDemandsGroupError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchTreatDemandsGroupError(error.request))
|
dispatch(fetchTreatDemandsGroupError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchTreatDemandsGroupError(error.message))
|
dispatch(fetchTreatDemandsGroupError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const treatDemandGroupReset = () => {
|
export const treatDemandGroupReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchTreatDemandsGroupReset());
|
dispatch(fetchTreatDemandsGroupReset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const joinGroupAction = (data) => {
|
export const joinGroupAction = (data) => {
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchJoinGroupPending());
|
dispatch(fetchJoinGroupPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${joinGroupUrl}`,
|
url: `${joinGroupUrl}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchJoinGroupSuccess(response));
|
dispatch(fetchJoinGroupSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchJoinGroupError(error.response));
|
dispatch(fetchJoinGroupError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchJoinGroupError(error.request))
|
dispatch(fetchJoinGroupError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchJoinGroupError(error.message))
|
dispatch(fetchJoinGroupError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const joinGroupReset = () => {
|
export const joinGroupReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchJoinGroupReset());
|
dispatch(fetchJoinGroupReset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const askNanoCreditAction = (data) => {
|
export const askNanoCreditAction = (data) => {
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchAskNanoCreditPending());
|
dispatch(fetchAskNanoCreditPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${askNanoCreditUrl}`,
|
url: `${askNanoCreditUrl}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchAskNanoCreditSuccess(response));
|
dispatch(fetchAskNanoCreditSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchAskNanoCreditError(error.response));
|
dispatch(fetchAskNanoCreditError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchAskNanoCreditError(error.request))
|
dispatch(fetchAskNanoCreditError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchAskNanoCreditError(error.message))
|
dispatch(fetchAskNanoCreditError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const askNanoCreditReset = () => {
|
export const askNanoCreditReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchAskNanoCreditReset());
|
dispatch(fetchAskNanoCreditReset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getNanoCreditDemandDurationAction = (data) => {
|
export const getNanoCreditDemandDurationAction = (data) => {
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchGetNanoCreditDemandDurationPending());
|
dispatch(fetchGetNanoCreditDemandDurationPending());
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${getNanoCreditDemandDureationUrl}`,
|
url: `${getNanoCreditDemandDureationUrl}`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
'X-Localization': I18n.currentLocale()
|
'X-Localization': I18n.currentLocale()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
dispatch(fetchGetNanoCreditDemandDurationSuccess(response));
|
dispatch(fetchGetNanoCreditDemandDurationSuccess(response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response)
|
if (error.response)
|
||||||
dispatch(fetchGetNanoCreditDemandDurationError(error.response));
|
dispatch(fetchGetNanoCreditDemandDurationError(error.response));
|
||||||
else if (error.request)
|
else if (error.request)
|
||||||
dispatch(fetchGetNanoCreditDemandDurationError(error.request))
|
dispatch(fetchGetNanoCreditDemandDurationError(error.request))
|
||||||
else
|
else
|
||||||
dispatch(fetchGetNanoCreditDemandDurationError(error.message))
|
dispatch(fetchGetNanoCreditDemandDurationError(error.message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getNanoCreditDemandDurationReset = () => {
|
export const getNanoCreditDemandDurationReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchGetNanoCreditDemandDurationReset());
|
dispatch(fetchGetNanoCreditDemandDurationReset());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getEpargneInProgressAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetEpargneInProgressPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${getHistoryNanoPendingCreditUrl}`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchGetEpargneInProgressSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchGetEpargneInProgressError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchGetEpargneInProgressError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchGetEpargneInProgressError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getEpargneInProgressReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetEpargneInProgressReset());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const getNanoCreditUserHistoryInProgressAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${getHistoryNanoPendingCreditUrl}/${data}`,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getNanoCreditUserHistoryInProgressReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetNanoCreditUserHistoryInProgressReset());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue