Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Agiliza
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
evologica
Agiliza
Commits
d9214454
Commit
d9214454
authored
Oct 07, 2021
by
Rafael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrige bugs com obter referências e veículos.
parent
c5e9603f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
116 additions
and
70 deletions
+116
-70
config.json
cli/web/cliente/public/config.json
+2
-2
customerData.tsx
...cliente/src/api/mappers/api/proposalData/customerData.tsx
+6
-1
customerData.ts
...iente/src/api/mappers/domain/proposalData/customerData.ts
+2
-1
customerData.ts
...web/cliente/src/api/useCases/proposalData/customerData.ts
+3
-3
slice.ts
...nte/src/redux/entities/proposalData/customerData/slice.ts
+19
-8
slice.ts
...cliente/src/redux/entities/proposalData/proposal/slice.ts
+0
-1
selectors.ts
...src/redux/useCases/proposalData/customerData/selectors.ts
+2
-0
slice.ts
...nte/src/redux/useCases/proposalData/customerData/slice.ts
+19
-9
state.ts
...s/ProposalData/pages/CustomerData/Identification/state.ts
+10
-22
connect.ts
...s/ProposalData/pages/CustomerData/PersonalData/connect.ts
+2
-1
References.tsx
...ProposalData/pages/CustomerData/References/References.tsx
+13
-6
connect.ts
...ews/ProposalData/pages/CustomerData/References/connect.ts
+1
-1
Vehicles.tsx
...ews/ProposalData/pages/CustomerData/Vehicles/Vehicles.tsx
+14
-2
conect.ts
.../views/ProposalData/pages/CustomerData/Vehicles/conect.ts
+1
-1
ProposalData.tsx
...web/cliente/src/views/ProposalData/pages/ProposalData.tsx
+18
-11
connect.ts
cli/web/cliente/src/views/ProposalData/pages/connect.ts
+3
-0
shared-styles.ts
cli/web/cliente/src/views/shared-styles.ts
+1
-1
No files found.
cli/web/cliente/public/config.json
View file @
d9214454
{
{
"API_URL"
:
"http://192.168.0.
65
:8080"
,
"API_URL"
:
"http://192.168.0.
34
:8080"
,
"APP_NAME_BROKER"
:
"@agiliza-dev/agente"
,
"APP_NAME_BROKER"
:
"@agiliza-dev/agente"
,
"APP_NAME_CUSTOMER"
:
"@agiliza-dev/cliente"
,
"APP_NAME_CUSTOMER"
:
"@agiliza-dev/cliente"
,
"SESSION_KEY_BROKER"
:
"@agiliza-dev/agente"
,
"SESSION_KEY_BROKER"
:
"@agiliza-dev/agente"
,
...
...
cli/web/cliente/src/api/mappers/api/proposalData/customerData.tsx
View file @
d9214454
...
@@ -68,7 +68,12 @@ export class AddInvolvedPersonIdentification implements ApiAdapter<InvolvedPerso
...
@@ -68,7 +68,12 @@ export class AddInvolvedPersonIdentification implements ApiAdapter<InvolvedPerso
nome
:
domain
.
name
,
nome
:
domain
.
name
,
cpfcnpj
:
extractNumbers
(
domain
.
cpfcnpj
),
cpfcnpj
:
extractNumbers
(
domain
.
cpfcnpj
),
sexo
:
domain
.
gender
,
sexo
:
domain
.
gender
,
tipo
:
domain
.
type
===
INVOLVED_PERSON_NAMES
[
'2'
]
?
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]
:
''
,
tipo
:
domain
.
type
===
INVOLVED_PERSON_NAMES
[
'2'
]
?
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]
:
domain
.
type
===
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]
?
domain
.
type
:
''
,
contaBanestes
:
domain
.
account
?
this
.
mapBanestesAccountToApi
(
domain
.
account
)
:
undefined
,
contaBanestes
:
domain
.
account
?
this
.
mapBanestesAccountToApi
(
domain
.
account
)
:
undefined
,
dadosTipo
:
domain
.
dataType
?
this
.
mapDateTypeToApi
(
domain
.
dataType
)
:
undefined
,
dadosTipo
:
domain
.
dataType
?
this
.
mapDateTypeToApi
(
domain
.
dataType
)
:
undefined
,
})
})
...
...
cli/web/cliente/src/api/mappers/domain/proposalData/customerData.ts
View file @
d9214454
...
@@ -11,6 +11,7 @@ import {
...
@@ -11,6 +11,7 @@ import {
Vehicle
,
Vehicle
,
Workplace
Workplace
}
from
'@agiliza/api/domain'
}
from
'@agiliza/api/domain'
import
{
INVOLVED_PERSON_NAMES
,
INVOLVED_PERSON_TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
import
{
EnderecoApiModel
,
EnderecoApiModel
,
ProjetoPessoaEnvolvidaConjugeApiModel
,
ProjetoPessoaEnvolvidaConjugeApiModel
,
...
@@ -61,7 +62,7 @@ export class CDIdentificationAdapter implements DomainAdapter<ProjetoPessoaEnvol
...
@@ -61,7 +62,7 @@ export class CDIdentificationAdapter implements DomainAdapter<ProjetoPessoaEnvol
name
:
pessoa
.
nome
,
name
:
pessoa
.
nome
,
cpfcnpj
:
pessoa
.
cpfcnpj
,
cpfcnpj
:
pessoa
.
cpfcnpj
,
gender
:
pessoa
.
sexo
,
gender
:
pessoa
.
sexo
,
type
:
pessoa
.
tipo
,
type
:
pessoa
.
tipo
===
INVOLVED_PERSON_NAMES
[
INVOLVED_PERSON_TYPES
.
CUSTOMER
]
?
INVOLVED_PERSON_TYPES
.
CUSTOMER
:
''
,
account
:
pessoa
.
contaBanestes
?
this
.
mapContaBanestesToDomain
(
pessoa
.
contaBanestes
)
:
undefined
,
account
:
pessoa
.
contaBanestes
?
this
.
mapContaBanestesToDomain
(
pessoa
.
contaBanestes
)
:
undefined
,
dataType
:
pessoa
.
dadosTipo
?
this
.
mapDadosTipoToDomain
(
pessoa
.
dadosTipo
)
:
undefined
,
dataType
:
pessoa
.
dadosTipo
?
this
.
mapDadosTipoToDomain
(
pessoa
.
dadosTipo
)
:
undefined
,
})
})
...
...
cli/web/cliente/src/api/useCases/proposalData/customerData.ts
View file @
d9214454
...
@@ -17,7 +17,7 @@ import {
...
@@ -17,7 +17,7 @@ import {
UpdateCDVehicle
UpdateCDVehicle
}
from
'@agiliza/api/domain'
}
from
'@agiliza/api/domain'
import
{
DadosCliente
}
from
'@agiliza/api/mappers/domain/proposalData'
import
{
DadosCliente
}
from
'@agiliza/api/mappers/domain/proposalData'
import
{
INVOLVED_PERSON_
NAMES
,
INVOLVED_PERSON_
TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
INVOLVED_PERSON_TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
ClienteApi
,
Configuration
}
from
'@microcredito/client'
import
{
ClienteApi
,
Configuration
}
from
'@microcredito/client'
import
{
ErrorMappers
,
ProposalDataApiMappers
,
ProposalDataMappers
}
from
'../../mappers'
import
{
ErrorMappers
,
ProposalDataApiMappers
,
ProposalDataMappers
}
from
'../../mappers'
...
@@ -106,8 +106,7 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
...
@@ -106,8 +106,7 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
try
{
try
{
const
pessoasEnvolvidas
=
await
this
.
api
.
obterPessoasEnvolvidas
({
projetoId
:
input
.
projectId
})
const
pessoasEnvolvidas
=
await
this
.
api
.
obterPessoasEnvolvidas
({
projetoId
:
input
.
projectId
})
const
involvedPeople
=
pessoasEnvolvidas
.
map
(
this
.
cdIdentificationMapper
.
mapApiModelToDomain
)
const
involvedPeople
=
pessoasEnvolvidas
.
map
(
this
.
cdIdentificationMapper
.
mapApiModelToDomain
)
console
.
log
(
involvedPeople
)
const
identification
=
involvedPeople
.
find
((
pE
)
=>
pE
.
type
===
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
])
const
identification
=
involvedPeople
.
find
((
pE
)
=>
pE
.
type
===
INVOLVED_PERSON_NAMES
[
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]])
return
identification
return
identification
}
catch
(
e
)
{
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
...
@@ -141,6 +140,7 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
...
@@ -141,6 +140,7 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
public
updateIdentification
=
async
(
input
:
UpdateCDIdentification
[
'Input'
]):
Promise
<
UpdateCDIdentification
[
'Output'
]
>
=>
{
public
updateIdentification
=
async
(
input
:
UpdateCDIdentification
[
'Input'
]):
Promise
<
UpdateCDIdentification
[
'Output'
]
>
=>
{
try
{
try
{
console
.
log
(
this
.
cdUpdateIdentificationApiMapper
.
mapDomainToApiModel
(
input
))
const
response
=
await
this
.
api
.
atualizarIdentificacaoPessoaEnvolvida
(
this
.
cdUpdateIdentificationApiMapper
.
mapDomainToApiModel
(
input
))
const
response
=
await
this
.
api
.
atualizarIdentificacaoPessoaEnvolvida
(
this
.
cdUpdateIdentificationApiMapper
.
mapDomainToApiModel
(
input
))
return
this
.
cdIdentificationMapper
.
mapApiModelToDomain
(
response
)
return
this
.
cdIdentificationMapper
.
mapApiModelToDomain
(
response
)
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
cli/web/cliente/src/redux/entities/proposalData/customerData/slice.ts
View file @
d9214454
...
@@ -50,6 +50,17 @@ const updateVehiclesReferences = (state: Store, pds: Vehicle[] = [], rfs: Refere
...
@@ -50,6 +50,17 @@ const updateVehiclesReferences = (state: Store, pds: Vehicle[] = [], rfs: Refere
state
.
references
.
byId
=
references
state
.
references
.
byId
=
references
state
.
references
.
allIds
=
keys
(
references
)
state
.
references
.
allIds
=
keys
(
references
)
}
}
const
updateReferences
=
(
state
:
Store
,
rfs
:
Reference
[])
=>
{
const
{
references
}
=
normalizeCustomerData
([],
rfs
)
state
.
references
.
byId
=
references
state
.
references
.
allIds
=
keys
(
references
)
}
const
updateVehicles
=
(
state
:
Store
,
vhs
:
Vehicle
[])
=>
{
const
{
vehicles
}
=
normalizeCustomerData
(
vhs
,
[])
state
.
vehicles
.
byId
=
vehicles
state
.
vehicles
.
allIds
=
keys
(
vehicles
)
}
export
default
createSlice
({
export
default
createSlice
({
name
:
`
${
PROPOSAL_DATA_PREFIX
}
/customerData`
,
name
:
`
${
PROPOSAL_DATA_PREFIX
}
/customerData`
,
...
@@ -69,27 +80,27 @@ export default createSlice({
...
@@ -69,27 +80,27 @@ export default createSlice({
},
},
[
customerDataTypes
.
getVehicles
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDVehicles
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
getVehicles
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDVehicles
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
updateVehicles
References
(
state
,
payload
)
updateVehicles
(
state
,
payload
)
},
},
[
customerDataTypes
.
update
Referenc
e
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDVehicle
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
update
Vehicl
e
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDVehicle
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
updateVehicles
References
(
state
,
payload
)
updateVehicles
(
state
,
payload
)
},
},
[
customerDataTypes
.
add
Referenc
e
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDVehicle
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
add
Vehicl
e
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDVehicle
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
updateVehicles
References
(
state
,
payload
)
updateVehicles
(
state
,
payload
)
},
},
[
customerDataTypes
.
getReferences
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDReferences
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
getReferences
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDReferences
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
update
VehiclesReferences
(
state
,
[]
,
payload
)
update
References
(
state
,
payload
)
},
},
[
customerDataTypes
.
updateReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDReference
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
updateReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDReference
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
update
VehiclesReferences
(
state
,
[]
,
payload
)
update
References
(
state
,
payload
)
},
},
[
customerDataTypes
.
addReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDReference
[
'Output'
]
>
)
=>
{
[
customerDataTypes
.
addReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDReference
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
const
{
payload
}
=
action
update
VehiclesReferences
(
state
,
[]
,
payload
)
update
References
(
state
,
payload
)
},
},
},
},
})
})
cli/web/cliente/src/redux/entities/proposalData/proposal/slice.ts
View file @
d9214454
...
@@ -38,7 +38,6 @@ export default createSlice({
...
@@ -38,7 +38,6 @@ export default createSlice({
state
.
personId
=
action
.
payload
.
id
state
.
personId
=
action
.
payload
.
id
},
},
[
customerDataTypes
.
getIdentification
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Identification
>
)
=>
{
[
customerDataTypes
.
getIdentification
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Identification
>
)
=>
{
console
.
log
(
action
.
payload
)
state
.
personId
=
action
.
payload
?.
id
state
.
personId
=
action
.
payload
?.
id
},
},
},
},
...
...
cli/web/cliente/src/redux/useCases/proposalData/customerData/selectors.ts
View file @
d9214454
...
@@ -2,3 +2,5 @@ import { State } from './slice'
...
@@ -2,3 +2,5 @@ import { State } from './slice'
export
const
isFetching
=
(
state
:
State
)
=>
state
.
fetching
export
const
isFetching
=
(
state
:
State
)
=>
state
.
fetching
export
const
isGettingCustomerData
=
(
state
:
State
)
=>
state
.
gettingCustomerData
export
const
isGettingCustomerData
=
(
state
:
State
)
=>
state
.
gettingCustomerData
export
const
isGettingReferences
=
(
state
:
State
)
=>
state
.
gettingReferences
export
const
isGettingVehicles
=
(
state
:
State
)
=>
state
.
gettingVehicles
cli/web/cliente/src/redux/useCases/proposalData/customerData/slice.ts
View file @
d9214454
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
GetCDReferences
,
GetCDReferences
,
GetCDVehicles
,
GetCDVehicles
,
GetCustomerData
,
GetCustomerData
,
InvolvedPerson
,
UpdateCDAddress
,
UpdateCDAddress
,
UpdateCDHome
,
UpdateCDHome
,
UpdateCDIdentification
,
UpdateCDIdentification
,
...
@@ -33,11 +34,15 @@ const prefix = 'useCases/customerData'
...
@@ -33,11 +34,15 @@ const prefix = 'useCases/customerData'
export
interface
State
{
export
interface
State
{
fetching
:
boolean
fetching
:
boolean
gettingCustomerData
:
boolean
gettingCustomerData
:
boolean
gettingReferences
:
boolean
gettingVehicles
:
boolean
}
}
export
const
initialState
:
State
=
{
export
const
initialState
:
State
=
{
fetching
:
false
,
fetching
:
false
,
gettingCustomerData
:
false
,
gettingCustomerData
:
false
,
gettingReferences
:
false
,
gettingVehicles
:
false
,
}
}
export
const
actions
=
{
export
const
actions
=
{
...
@@ -181,16 +186,19 @@ export const actions = {
...
@@ -181,16 +186,19 @@ export const actions = {
return
thunkApi
.
rejectWithValue
(
e
)
return
thunkApi
.
rejectWithValue
(
e
)
}
}
}),
}),
getCustomerData
:
createAsyncThunk
(
`
${
prefix
}
/getCustomerData`
,
async
(
input
:
WithSuccess
<
GetCustomerData
[
'Input'
]
>
,
thunkApi
)
=>
{
getCustomerData
:
createAsyncThunk
(
`
${
prefix
}
/getCustomerData`
,
async
(
input
:
WithSuccess
<
GetCustomerData
[
'Input'
],
Omit
<
InvolvedPerson
,
'id'
>>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
try
{
const
response
=
await
useCase
.
getCustomerData
(
input
)
const
response
=
await
useCase
.
getCustomerData
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
(
)
input
.
onSuccess
&&
input
.
onSuccess
(
response
)
return
response
return
response
}
catch
(
e
)
{
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
return
thunkApi
.
rejectWithValue
(
e
)
}
}
}),
}
),
getIdentification
:
createAsyncThunk
(
`
${
prefix
}
/getIdentification`
,
async
(
input
:
WithSuccess
<
GetCDIdentification
[
'Input'
],
string
>
,
thunkApi
)
=>
{
getIdentification
:
createAsyncThunk
(
`
${
prefix
}
/getIdentification`
,
async
(
input
:
WithSuccess
<
GetCDIdentification
[
'Input'
],
string
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
try
{
...
@@ -211,6 +219,8 @@ const login = createSlice({
...
@@ -211,6 +219,8 @@ const login = createSlice({
extraReducers
:
{
extraReducers
:
{
...
values
(
types
).
reduce
((
reducers
,
type
)
=>
({
...
reducers
,
...
createAsyncReducers
(
type
)
}),
{}),
...
values
(
types
).
reduce
((
reducers
,
type
)
=>
({
...
reducers
,
...
createAsyncReducers
(
type
)
}),
{}),
...
createAsyncReducers
(
types
.
getCustomerData
,
'gettingCustomerData'
),
...
createAsyncReducers
(
types
.
getCustomerData
,
'gettingCustomerData'
),
...
createAsyncReducers
(
types
.
getReferences
,
'gettingReferences'
),
...
createAsyncReducers
(
types
.
getVehicles
,
'gettingVehicles'
),
},
},
})
})
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/Identification/state.ts
View file @
d9214454
...
@@ -7,19 +7,7 @@ export interface CDIdentificationState extends ExtendedState {
...
@@ -7,19 +7,7 @@ export interface CDIdentificationState extends ExtendedState {
hasAccount
:
boolean
hasAccount
:
boolean
}
}
export
const
initialState
:
CDIdentificationState
=
export
const
initialState
:
CDIdentificationState
=
{
process
.
env
.
NODE_ENV
===
'development'
?
{
id
:
''
,
name
:
'TEST'
,
cpfcnpj
:
'80.162.745/0001-96'
,
gender
:
'1'
,
type
:
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
],
hasAccount
:
false
,
account
:
{
agencyNumber
:
''
,
number
:
''
,
cardPicture
:
''
},
dataType
:
{
doesWithdrawal
:
false
,
framework
:
'1'
},
}
:
{
id
:
''
,
id
:
''
,
name
:
''
,
name
:
''
,
cpfcnpj
:
''
,
cpfcnpj
:
''
,
...
@@ -28,4 +16,4 @@ export const initialState: CDIdentificationState =
...
@@ -28,4 +16,4 @@ export const initialState: CDIdentificationState =
hasAccount
:
false
,
hasAccount
:
false
,
account
:
{
agencyNumber
:
''
,
number
:
''
,
cardPicture
:
''
},
account
:
{
agencyNumber
:
''
,
number
:
''
,
cardPicture
:
''
},
dataType
:
{
doesWithdrawal
:
false
,
framework
:
''
},
dataType
:
{
doesWithdrawal
:
false
,
framework
:
''
},
}
}
cli/web/cliente/src/views/ProposalData/pages/CustomerData/PersonalData/connect.ts
View file @
d9214454
...
@@ -11,7 +11,7 @@ export interface ConnectedProps {
...
@@ -11,7 +11,7 @@ export interface ConnectedProps {
}
}
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'context'
>
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'context'
>
// type DispatchProps = Pick<ConnectedProps, '
updateIndentification
'>
// type DispatchProps = Pick<ConnectedProps, '
getReferences
'>
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalDataContext
.
selectors
.
isFetching
(
state
.
ui
.
login
),
fetching
:
ucProposalDataContext
.
selectors
.
isFetching
(
state
.
ui
.
login
),
...
@@ -21,6 +21,7 @@ const mapStateToProps = (state: StoreState): StateProps => ({
...
@@ -21,6 +21,7 @@ const mapStateToProps = (state: StoreState): StateProps => ({
// const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
// const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
// bindActionCreators(
// bindActionCreators(
// {
// {
// getReferences: ucProposalData.actions.getReferences,
// },
// },
// dispatch
// dispatch
// )
// )
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/References/References.tsx
View file @
d9214454
...
@@ -2,7 +2,14 @@ import React, { useEffect, useState } from 'react'
...
@@ -2,7 +2,14 @@ import React, { useEffect, useState } from 'react'
import
{
Reference
}
from
'@agiliza/api/domain/proposalData/involvedPeople/reference'
import
{
Reference
}
from
'@agiliza/api/domain/proposalData/involvedPeople/reference'
import
{
ActionType
}
from
'@agiliza/utils/hooks/state'
import
{
ActionType
}
from
'@agiliza/utils/hooks/state'
import
{
Avatar
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
}
from
'@material-ui/core'
import
{
Avatar
,
CircularProgress
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
Add
as
AddIcon
,
EmojiEmotions
as
EmojiEmotionsIcon
}
from
'@material-ui/icons'
import
{
Add
as
AddIcon
,
EmojiEmotions
as
EmojiEmotionsIcon
}
from
'@material-ui/icons'
...
@@ -23,14 +30,12 @@ interface Props extends ExtendedProps {
...
@@ -23,14 +30,12 @@ interface Props extends ExtendedProps {
const
References
=
(
props
:
Props
)
=>
{
const
References
=
(
props
:
Props
)
=>
{
const
{
classes
,
fetching
,
context
,
state
,
actions
,
references
,
projectId
,
personId
}
=
props
const
{
classes
,
fetching
,
context
,
state
,
actions
,
references
,
projectId
,
personId
}
=
props
console
.
log
(
personId
)
const
[
selectedReference
,
setSelectedReference
]
=
useState
<
Reference
|
undefined
>
()
const
[
selectedReference
,
setSelectedReference
]
=
useState
<
Reference
|
undefined
>
()
const
[
open
,
setOpen
]
=
useState
(
false
)
const
[
open
,
setOpen
]
=
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
props
.
getReferences
({
p
ersonId
,
project
Id
})
props
.
getReferences
({
p
rojectId
,
person
Id
})
},
[])
},
[])
const
handleClickListItem
=
(
reference
:
Reference
)
=>
()
=>
{
const
handleClickListItem
=
(
reference
:
Reference
)
=>
()
=>
{
...
@@ -49,8 +54,8 @@ const References = (props: Props) => {
...
@@ -49,8 +54,8 @@ const References = (props: Props) => {
const
handleSave
=
(
reference
:
Reference
,
add
:
boolean
)
=>
()
=>
{
const
handleSave
=
(
reference
:
Reference
,
add
:
boolean
)
=>
()
=>
{
const
onSuccess
=
()
=>
{
const
onSuccess
=
()
=>
{
setOpen
(
false
)
//
setOpen(false)
setSelectedReference
(
reference
)
//
setSelectedReference(reference)
}
}
if
(
add
)
if
(
add
)
props
.
addReference
({
props
.
addReference
({
...
@@ -69,6 +74,8 @@ const References = (props: Props) => {
...
@@ -69,6 +74,8 @@ const References = (props: Props) => {
})
})
}
}
if
(
fetching
)
return
<
CircularProgress
className=
{
classes
.
circularProgress
}
/>
return
(
return
(
<>
<>
<
div
className=
{
classes
.
contentContainer
}
>
<
div
className=
{
classes
.
contentContainer
}
>
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/References/connect.ts
View file @
d9214454
...
@@ -20,7 +20,7 @@ type StateProps = Pick<ConnectedProps, 'fetching' | 'context' | 'references'>
...
@@ -20,7 +20,7 @@ type StateProps = Pick<ConnectedProps, 'fetching' | 'context' | 'references'>
type
DispatchProps
=
Pick
<
ConnectedProps
,
'getReferences'
|
'addReference'
|
'updateReference'
>
type
DispatchProps
=
Pick
<
ConnectedProps
,
'getReferences'
|
'addReference'
|
'updateReference'
>
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalData
.
selectors
.
is
Fetching
(
state
.
useCases
.
proposalData
.
customerData
),
fetching
:
ucProposalData
.
selectors
.
is
GettingReferences
(
state
.
useCases
.
proposalData
.
customerData
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
references
:
entCustomerData
.
selectors
.
getReferences
(
state
.
entities
.
proposalData
.
customerData
),
references
:
entCustomerData
.
selectors
.
getReferences
(
state
.
entities
.
proposalData
.
customerData
),
})
})
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/Vehicles/Vehicles.tsx
View file @
d9214454
import
React
,
{
useState
}
from
'react'
import
React
,
{
use
Effect
,
use
State
}
from
'react'
import
{
Vehicle
}
from
'@agiliza/api/domain'
import
{
Vehicle
}
from
'@agiliza/api/domain'
import
{
ActionType
}
from
'@agiliza/utils/hooks/state'
import
{
ActionType
}
from
'@agiliza/utils/hooks/state'
import
{
Avatar
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
}
from
'@material-ui/core'
import
{
Avatar
,
CircularProgress
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
Add
as
AddIcon
,
DriveEta
as
DriveEtaIcon
}
from
'@material-ui/icons'
import
{
Add
as
AddIcon
,
DriveEta
as
DriveEtaIcon
}
from
'@material-ui/icons'
...
@@ -26,6 +33,9 @@ const Vehicles = (props: Props) => {
...
@@ -26,6 +33,9 @@ const Vehicles = (props: Props) => {
const
[
selectedVehicle
,
setSelectedVehicle
]
=
useState
<
Vehicle
|
undefined
>
()
const
[
selectedVehicle
,
setSelectedVehicle
]
=
useState
<
Vehicle
|
undefined
>
()
const
[
open
,
setOpen
]
=
useState
(
false
)
const
[
open
,
setOpen
]
=
useState
(
false
)
useEffect
(()
=>
{
props
.
getVehicles
({
personId
,
projectId
})
},
[])
const
handleClickListItem
=
(
vehicle
:
Vehicle
)
=>
()
=>
{
const
handleClickListItem
=
(
vehicle
:
Vehicle
)
=>
()
=>
{
setOpen
(
true
)
setOpen
(
true
)
...
@@ -64,6 +74,8 @@ const Vehicles = (props: Props) => {
...
@@ -64,6 +74,8 @@ const Vehicles = (props: Props) => {
})
})
}
}
if
(
fetching
)
return
<
CircularProgress
className=
{
classes
.
circularProgress
}
/>
return
(
return
(
<>
<>
<
div
className=
{
classes
.
contentContainer
}
>
<
div
className=
{
classes
.
contentContainer
}
>
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/Vehicles/conect.ts
View file @
d9214454
...
@@ -20,7 +20,7 @@ type StateProps = Pick<ConnectedProps, 'fetching' | 'context' | 'vehicles'>
...
@@ -20,7 +20,7 @@ type StateProps = Pick<ConnectedProps, 'fetching' | 'context' | 'vehicles'>
type
DispatchProps
=
Pick
<
ConnectedProps
,
'getVehicles'
|
'addVehicle'
|
'updateVehicle'
>
type
DispatchProps
=
Pick
<
ConnectedProps
,
'getVehicles'
|
'addVehicle'
|
'updateVehicle'
>
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalData
.
selectors
.
is
Fetching
(
state
.
useCases
.
proposalData
.
customerData
),
fetching
:
ucProposalData
.
selectors
.
is
GettingVehicles
(
state
.
useCases
.
proposalData
.
customerData
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
vehicles
:
entCustomerData
.
selectors
.
getVehicles
(
state
.
entities
.
proposalData
.
customerData
),
vehicles
:
entCustomerData
.
selectors
.
getVehicles
(
state
.
entities
.
proposalData
.
customerData
),
})
})
...
...
cli/web/cliente/src/views/ProposalData/pages/ProposalData.tsx
View file @
d9214454
...
@@ -88,7 +88,12 @@ const ProposalData = (props: Props) => {
...
@@ -88,7 +88,12 @@ const ProposalData = (props: Props) => {
props
.
getCDIdentification
({
props
.
getCDIdentification
({
projectId
:
proposalId
,
projectId
:
proposalId
,
onSuccess
:
(
pID
)
=>
{
onSuccess
:
(
pID
)
=>
{
if
(
pID
)
props
.
getCustomerData
({
projectId
:
proposalId
,
personId
:
pID
})
if
(
pID
)
props
.
getCustomerData
({
projectId
:
proposalId
,
personId
:
pID
,
onSuccess
:
(
cD
)
=>
{},
})
},
},
})
})
},
[])
},
[])
...
@@ -137,20 +142,18 @@ const ProposalData = (props: Props) => {
...
@@ -137,20 +142,18 @@ const ProposalData = (props: Props) => {
else
return
idn
else
return
idn
},
{})
},
{})
)
)
},
[
customerData
])
useEffect
(()
=>
{
const
{
identification
:
bdIdentification
,
address
:
bdAddress
,
stockSalesCosts
}
=
businessData
const
{
identification
,
address
,
stockSalesCosts
}
=
businessData
if
(
bdIdentification
)
if
(
identification
)
bdIdentificationState
.
actions
.
update
(
bdIdentificationState
.
actions
.
update
(
entries
(
i
dentification
).
reduce
((
idn
,
[
k
,
v
])
=>
{
entries
(
bdI
dentification
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
else
return
idn
},
{})
},
{})
)
)
if
(
a
ddress
)
if
(
bdA
ddress
)
bdAddressState
.
actions
.
update
(
bdAddressState
.
actions
.
update
(
entries
(
a
ddress
).
reduce
((
idn
,
[
k
,
v
])
=>
{
entries
(
bdA
ddress
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
else
return
idn
},
{})
},
{})
...
@@ -162,7 +165,7 @@ const ProposalData = (props: Props) => {
...
@@ -162,7 +165,7 @@ const ProposalData = (props: Props) => {
else
return
idn
else
return
idn
},
{})
},
{})
)
)
},
[
businessData
])
},
[
customerData
,
businessData
])
const
customerDataItems
=
useMemo
(
const
customerDataItems
=
useMemo
(
()
=>
[
()
=>
[
...
@@ -171,7 +174,11 @@ const ProposalData = (props: Props) => {
...
@@ -171,7 +174,11 @@ const ProposalData = (props: Props) => {
icon
:
<
AccountBoxIcon
/>,
icon
:
<
AccountBoxIcon
/>,
component
:
<
Identification
state=
{
cdIdentification
.
state
}
actions=
{
cdIdentification
.
actions
}
/>,
component
:
<
Identification
state=
{
cdIdentification
.
state
}
actions=
{
cdIdentification
.
actions
}
/>,
},
},
{
label
:
'Dados Pessoais'
,
icon
:
<
ListIcon
/>,
component
:
<
PersonalData
state=
{
cdPersonalData
.
state
}
actions=
{
cdPersonalData
.
actions
}
/>
},
{
label
:
'Dados Pessoais'
,
icon
:
<
ListIcon
/>,
component
:
<
PersonalData
state=
{
cdPersonalData
.
state
}
actions=
{
cdPersonalData
.
actions
}
/>,
},
{
label
:
'Endereço'
,
icon
:
<
ContactMailIcon
/>,
component
:
<
Address
state=
{
cdAddress
.
state
}
actions=
{
cdAddress
.
actions
}
/>
},
{
label
:
'Endereço'
,
icon
:
<
ContactMailIcon
/>,
component
:
<
Address
state=
{
cdAddress
.
state
}
actions=
{
cdAddress
.
actions
}
/>
},
{
label
:
'Fonte de renda'
,
icon
:
<
LocalAtmIcon
/>,
component
:
<
SourceIncome
state=
{
cdSourceIncome
.
state
}
actions=
{
cdSourceIncome
.
actions
}
/>
},
{
label
:
'Fonte de renda'
,
icon
:
<
LocalAtmIcon
/>,
component
:
<
SourceIncome
state=
{
cdSourceIncome
.
state
}
actions=
{
cdSourceIncome
.
actions
}
/>
},
{
label
:
'Cônjuge - Ident.'
,
icon
:
<
ForumIcon
/>,
component
:
<
SpouseData
state=
{
cdSpouseData
.
state
}
actions=
{
cdSpouseData
.
actions
}
/>
},
{
label
:
'Cônjuge - Ident.'
,
icon
:
<
ForumIcon
/>,
component
:
<
SpouseData
state=
{
cdSpouseData
.
state
}
actions=
{
cdSpouseData
.
actions
}
/>
},
...
@@ -192,7 +199,7 @@ const ProposalData = (props: Props) => {
...
@@ -192,7 +199,7 @@ const ProposalData = (props: Props) => {
component
:
<
Vehicles
state=
{
cdVehicleState
.
state
}
actions=
{
cdVehicleState
.
actions
}
projectId=
{
proposalId
}
personId=
{
personId
}
/>,
component
:
<
Vehicles
state=
{
cdVehicleState
.
state
}
actions=
{
cdVehicleState
.
actions
}
projectId=
{
proposalId
}
personId=
{
personId
}
/>,
},
},
],
],
[
cdIdentification
,
cdPersonalData
,
cdAddress
,
cdSpouseData
,
cdReference
,
cdHomeState
,
cdVehicleState
]
[
cdIdentification
,
cdPersonalData
,
cdAddress
,
cdS
ourceIncome
,
cdS
pouseData
,
cdReference
,
cdHomeState
,
cdVehicleState
]
)
)
const
businessDataItems
=
useMemo
(
const
businessDataItems
=
useMemo
(
...
...
cli/web/cliente/src/views/ProposalData/pages/connect.ts
View file @
d9214454
...
@@ -36,6 +36,7 @@ export interface ConnectedProps {
...
@@ -36,6 +36,7 @@ export interface ConnectedProps {
getCDIdentification
:
typeof
ucProposalDataCD
.
actions
.
getIdentification
getCDIdentification
:
typeof
ucProposalDataCD
.
actions
.
getIdentification
getCustomerData
:
typeof
ucProposalDataCD
.
actions
.
getCustomerData
getCustomerData
:
typeof
ucProposalDataCD
.
actions
.
getCustomerData
getBusinessData
:
typeof
ucProposalDataBD
.
actions
.
getBusinessData
getBusinessData
:
typeof
ucProposalDataBD
.
actions
.
getBusinessData
getReferences
:
typeof
ucProposalDataCD
.
actions
.
getReferences
}
}
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'proposalId'
|
'personId'
|
'businessData'
|
'customerData'
>
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'proposalId'
|
'personId'
|
'businessData'
|
'customerData'
>
...
@@ -58,6 +59,7 @@ type DispatchProps = Pick<
...
@@ -58,6 +59,7 @@ type DispatchProps = Pick<
|
'getCDIdentification'
|
'getCDIdentification'
|
'getCustomerData'
|
'getCustomerData'
|
'getBusinessData'
|
'getBusinessData'
|
'getReferences'
>
>
const
isFetching
=
createSelector
(
const
isFetching
=
createSelector
(
...
@@ -99,6 +101,7 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
...
@@ -99,6 +101,7 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
getBusinessData
:
ucProposalDataBD
.
actions
.
getBusinessData
,
getBusinessData
:
ucProposalDataBD
.
actions
.
getBusinessData
,
getCustomerData
:
ucProposalDataCD
.
actions
.
getCustomerData
,
getCustomerData
:
ucProposalDataCD
.
actions
.
getCustomerData
,
getCDIdentification
:
ucProposalDataCD
.
actions
.
getIdentification
,
getCDIdentification
:
ucProposalDataCD
.
actions
.
getIdentification
,
getReferences
:
ucProposalDataCD
.
actions
.
getReferences
,
},
},
dispatch
dispatch
)
)
...
...
cli/web/cliente/src/views/shared-styles.ts
View file @
d9214454
...
@@ -11,7 +11,7 @@ export default (theme: Theme) => {
...
@@ -11,7 +11,7 @@ export default (theme: Theme) => {
padding
:
theme
.
spacing
(
2
),
padding
:
theme
.
spacing
(
2
),
display
:
'flex'
,
display
:
'flex'
,
flexDirection
:
'column'
,
flexDirection
:
'column'
,
overflowY
:
'
hidden
'
,
overflowY
:
'
auto
'
,
},
},
title
:
{
title
:
{
flexGrow
:
1
,
flexGrow
:
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment