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
4d5d769e
Commit
4d5d769e
authored
Sep 15, 2021
by
Rafael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adiciona retomada de edição de propostas.
parent
b3dd6675
Pipeline
#8008
passed with stage
in 9 minutes and 45 seconds
Changes
76
Pipelines
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
76 changed files
with
1696 additions
and
262 deletions
+1696
-262
pdcase.png
cli/web/agente/public/images/pdcase.png
+0
-0
webpack.config.js
cli/web/agente/webpack.config.js
+1
-1
.yarnrc
cli/web/cliente/.yarnrc
+1
-1
package.json
cli/web/cliente/package.json
+3
-3
config.json
cli/web/cliente/public/config.json
+6
-6
pdcase.png
cli/web/cliente/public/images/pdcase.png
+0
-0
event.d.ts
cli/web/cliente/src/api/domain/event.d.ts
+7
-0
index.d.ts
cli/web/cliente/src/api/domain/index.d.ts
+19
-0
index.d.ts
cli/web/cliente/src/api/domain/project/index.d.ts
+10
-5
index.d.ts
...iente/src/api/domain/proposalData/businessData/index.d.ts
+18
-2
stockSalesCosts.d.ts
...api/domain/proposalData/businessData/stockSalesCosts.d.ts
+3
-3
identification.d.ts
...pi/domain/proposalData/involvedPeople/identification.d.ts
+23
-3
index.d.ts
...nte/src/api/domain/proposalData/involvedPeople/index.d.ts
+11
-0
schedule.d.ts
cli/web/cliente/src/api/domain/schedule.d.ts
+93
-0
simulation.d.ts
cli/web/cliente/src/api/domain/simulation/simulation.d.ts
+9
-0
businessData.ts
.../cliente/src/api/mappers/api/proposalData/businessData.ts
+3
-3
customerData.tsx
...cliente/src/api/mappers/api/proposalData/customerData.tsx
+17
-1
index.ts
cli/web/cliente/src/api/mappers/domain/index.ts
+11
-1
project.ts
cli/web/cliente/src/api/mappers/domain/project.ts
+75
-0
businessData.ts
...iente/src/api/mappers/domain/proposalData/businessData.ts
+29
-3
customerData.ts
...iente/src/api/mappers/domain/proposalData/customerData.ts
+55
-0
schedule.ts
cli/web/cliente/src/api/mappers/domain/schedule.ts
+193
-0
simulation.ts
...b/cliente/src/api/mappers/domain/simulation/simulation.ts
+13
-4
user.ts
cli/web/cliente/src/api/mappers/domain/user.ts
+42
-0
project.ts
cli/web/cliente/src/api/useCases/project.ts
+48
-0
businessData.ts
...web/cliente/src/api/useCases/proposalData/businessData.ts
+22
-0
customerData.ts
...web/cliente/src/api/useCases/proposalData/customerData.ts
+62
-3
index.tsx
cli/web/cliente/src/components/atoms/AuthRoute/index.tsx
+3
-2
PhoneField.tsx
...liente/src/components/organisms/PhoneField/PhoneField.tsx
+1
-1
amortization.ts
cli/web/cliente/src/constants/amortization.ts
+5
-0
index.ts
cli/web/cliente/src/redux/entities/index.ts
+4
-0
index.ts
cli/web/cliente/src/redux/entities/project/index.ts
+13
-0
selectors.ts
cli/web/cliente/src/redux/entities/project/selectors.ts
+13
-0
shared.ts
cli/web/cliente/src/redux/entities/project/shared.ts
+18
-0
slice.ts
cli/web/cliente/src/redux/entities/project/slice.ts
+29
-0
index.ts
...nte/src/redux/entities/proposalData/businessData/index.ts
+13
-0
selectors.ts
...src/redux/entities/proposalData/businessData/selectors.ts
+27
-0
shared.ts
...te/src/redux/entities/proposalData/businessData/shared.ts
+18
-0
slice.ts
...nte/src/redux/entities/proposalData/businessData/slice.ts
+59
-0
index.ts
...nte/src/redux/entities/proposalData/customerData/index.ts
+13
-0
selectors.ts
...src/redux/entities/proposalData/customerData/selectors.ts
+33
-0
shared.ts
...te/src/redux/entities/proposalData/customerData/shared.ts
+22
-0
slice.ts
...nte/src/redux/entities/proposalData/customerData/slice.ts
+95
-0
index.ts
cli/web/cliente/src/redux/entities/proposalData/index.ts
+15
-1
selectors.ts
...nte/src/redux/entities/proposalData/proposal/selectors.ts
+3
-3
slice.ts
...cliente/src/redux/entities/proposalData/proposal/slice.ts
+16
-49
reducer.ts
cli/web/cliente/src/redux/session/reducer.ts
+0
-1
slice.ts
cli/web/cliente/src/redux/ui/login/slice.ts
+2
-1
slice.ts
cli/web/cliente/src/redux/ui/simulation/slice.ts
+2
-0
index.ts
cli/web/cliente/src/redux/useCases/index.ts
+4
-0
index.ts
cli/web/cliente/src/redux/useCases/project/index.ts
+6
-0
selectors.ts
cli/web/cliente/src/redux/useCases/project/selectors.ts
+3
-0
slice.ts
cli/web/cliente/src/redux/useCases/project/slice.ts
+35
-0
selectors.ts
...src/redux/useCases/proposalData/businessData/selectors.ts
+1
-0
slice.ts
...nte/src/redux/useCases/proposalData/businessData/slice.ts
+14
-0
selectors.ts
...src/redux/useCases/proposalData/customerData/selectors.ts
+1
-0
slice.ts
...nte/src/redux/useCases/proposalData/customerData/slice.ts
+40
-4
Login.tsx
cli/web/cliente/src/views/Login/Login.tsx
+3
-2
Main.tsx
cli/web/cliente/src/views/Main/Main.tsx
+44
-9
connect.ts
cli/web/cliente/src/views/Main/connect.ts
+4
-0
ListProjects.tsx
...te/src/views/Projects/pages/ListProjects/ListProjects.tsx
+30
-5
connect.ts
.../cliente/src/views/Projects/pages/ListProjects/connect.ts
+20
-10
router.tsx
cli/web/cliente/src/views/Projects/pages/router.tsx
+37
-0
state.ts
...s/ProposalData/pages/BusinessData/Identification/state.ts
+32
-32
connect.ts
...oposalData/pages/BusinessData/ProductsServices/connect.ts
+2
-2
connect.ts
...roposalData/pages/BusinessData/StockSalesCosts/connect.ts
+2
-2
state.ts
.../ProposalData/pages/BusinessData/StockSalesCosts/state.ts
+2
-2
connect.ts
...ews/ProposalData/pages/CustomerData/References/connect.ts
+2
-2
conect.ts
.../views/ProposalData/pages/CustomerData/Vehicles/conect.ts
+2
-2
ProposalData.tsx
...web/cliente/src/views/ProposalData/pages/ProposalData.tsx
+101
-10
connect.ts
cli/web/cliente/src/views/ProposalData/pages/connect.ts
+25
-4
CreditLinesInfo.tsx
...ines/pages/Simulation/CreditLinesInfo/CreditLinesInfo.tsx
+12
-2
Simulation.tsx
...ews/SimulationCreditLines/pages/Simulation/Simulation.tsx
+1
-1
tsconfig.json
cli/web/cliente/tsconfig.json
+1
-0
webpack.config.js
cli/web/cliente/webpack.config.js
+1
-1
yarn.lock
cli/web/cliente/yarn.lock
+93
-75
No files found.
cli/web/agente/public/images/pdcase.png
0 → 100644
View file @
4d5d769e
3.39 KB
cli/web/agente/webpack.config.js
View file @
4d5d769e
...
...
@@ -116,7 +116,7 @@ const makeCommonPlugins = (env) => [
}),
new
HtmlWebpackPlugin
({
template
:
path
.
join
(
__dirname
,
'public'
,
'index.ejs'
),
favicon
:
path
.
join
(
PUBLIC
,
'images'
,
'
favicon
.png'
),
favicon
:
path
.
join
(
PUBLIC
,
'images'
,
'
pdcase
.png'
),
title
:
'Agiliza - Agente'
,
inject
:
false
,
}),
...
...
cli/web/cliente/.yarnrc
View file @
4d5d769e
--registry "https://nexus.dev.evologica.com.br/repository/npm"
--registry "https://nexus.dev.evologica.com.br/repository/npm
/
"
"@curio:registry" "https://nexus.dev.evologica.com.br/repository/npm"
"@dynamo:registry" "https://nexus.dev.evologica.com.br/repository/npm"
\ No newline at end of file
cli/web/cliente/package.json
View file @
4d5d769e
...
...
@@ -51,8 +51,8 @@
"@types/webpack"
:
"5.28.0"
,
"@types/webpack-bundle-analyzer"
:
"4.4.0"
,
"@types/webpack-dev-server"
:
"3.11.4"
,
"@typescript-eslint/eslint-plugin"
:
"^4.
25
.0"
,
"@typescript-eslint/parser"
:
"^4.2
5.0
"
,
"@typescript-eslint/eslint-plugin"
:
"^4.
31
.0"
,
"@typescript-eslint/parser"
:
"^4.2
9.2
"
,
"autoprefixer"
:
"^10.2.5"
,
"babel-eslint"
:
"^10.1.0"
,
"babel-loader"
:
"8.2.2"
,
...
...
@@ -90,7 +90,7 @@
"@material-ui/icons"
:
"^4.11.2"
,
"@material-ui/lab"
:
"4.0.0-alpha.58"
,
"@material-ui/pickers"
:
"^3.3.10"
,
"@microcredito/client"
:
"^0.7.2
2
"
,
"@microcredito/client"
:
"^0.7.2
6
"
,
"@reduxjs/toolkit"
:
"^1.2.5"
,
"@types/react-swipeable-views"
:
"^0.13.1"
,
"@types/react-swipeable-views-utils"
:
"^0.13.3"
,
...
...
cli/web/cliente/public/config.json
View file @
4d5d769e
{
"API_URL"
:
"http
s://microcredito.dev.evologica.com.br
"
,
"APP_NAME_BROKER"
:
"@
microcredito
/agente"
,
"APP_NAME_CUSTOMER"
:
"@
microcredito
/cliente"
,
"SESSION_KEY_BROKER"
:
"@
microcredito
/agente"
,
"SESSION_KEY_CUSTOMER"
:
"@
microcredito
/cliente"
}
"API_URL"
:
"http
://192.168.0.65:8080
"
,
"APP_NAME_BROKER"
:
"@
agiliza-dev
/agente"
,
"APP_NAME_CUSTOMER"
:
"@
agiliza-dev
/cliente"
,
"SESSION_KEY_BROKER"
:
"@
agiliza-dev
/agente"
,
"SESSION_KEY_CUSTOMER"
:
"@
agiliza-dev
/cliente"
}
\ No newline at end of file
cli/web/cliente/public/images/pdcase.png
0 → 100644
View file @
4d5d769e
3.39 KB
cli/web/cliente/src/api/domain/event.d.ts
0 → 100644
View file @
4d5d769e
import
{
Entity
}
from
'@agiliza/utils/method'
export
interface
Event
extends
Entity
{
date
:
Date
title
:
string
description
:
string
}
cli/web/cliente/src/api/domain/index.d.ts
View file @
4d5d769e
...
...
@@ -5,6 +5,9 @@ export * from './context'
export
*
from
'./error'
export
*
from
'./simulation'
export
*
from
'./authentication'
export
*
from
'./schedule'
export
*
from
'./project'
export
*
from
'./event'
export
interface
Customer
{
name
:
string
...
...
@@ -38,3 +41,19 @@ export interface Document {
extraInformations
:
string
url
:
string
}
export
interface
UserClient
{
cpfcnpj
:
string
name
:
string
}
export
interface
UserCustomer
{
name
:
string
email
:
string
ownerName
?:
string
ownerCPF
?:
string
cpfcnpj
:
string
phone
:
string
avatarUrl
?:
string
address
?:
Partial
<
Address
>
}
cli/web/cliente/src/api/domain/project/index.d.ts
View file @
4d5d769e
...
...
@@ -13,7 +13,7 @@ export interface Project extends Entity {
documents
?:
Document
[]
processNumber
:
string
permissions
?:
ProjectPermissions
schedules
:
Schedule
[]
schedules
?
:
Schedule
[]
// customer: UserCustomer
// involvedPeople?: InvolvedPerson[]
// businessData?: BusinessData
...
...
@@ -56,10 +56,10 @@ interface InputGetProjects {
statuses
?:
number
[]
}
export
interface
GetProjects
{
Input
:
InputGetProjects
Output
:
Project
[]
}
//
export interface GetProjects {
//
Input: InputGetProjects
//
Output: Project[]
//
}
interface
InputSubmitProjects
{
ids
:
string
[]
...
...
@@ -69,3 +69,8 @@ export interface SubmitProjects {
Input
:
InputSubmitProjects
Output
:
void
}
export
interface
GetProjects
{
Input
:
void
Output
:
Project
[]
}
cli/web/cliente/src/api/domain/proposalData/businessData/index.d.ts
View file @
4d5d769e
import
type
{
BDIdentification
}
from
'./identification'
import
type
{
BDAddress
}
from
'./address'
import
type
{
StockSalesCosts
}
from
'./stockSalesCosts'
import
type
{
BD
StockSalesCosts
}
from
'./stockSalesCosts'
import
type
{
BDProductService
}
from
'./productService'
export
interface
BusinessData
{
identification
?:
BDIdentification
address
?:
BDAddress
stockSalesCosts
?:
StockSalesCosts
stockSalesCosts
?:
BD
StockSalesCosts
productsServices
?:
BDProductService
[]
}
...
...
@@ -14,3 +14,19 @@ export * from './address'
export
*
from
'./identification'
export
*
from
'./productService'
export
*
from
'./stockSalesCosts'
// interface OutputGetBusinessData {
// identification: BDIdentification
// address: BDAddress
// productService: BDProductService
// stockSalesCosts: BDStockSalesCosts
// }
interface
InputGetBusinessData
{
projectId
:
string
}
export
interface
GetBusinessData
{
Input
:
InputGetBusinessData
Output
:
BusinessData
}
cli/web/cliente/src/api/domain/proposalData/businessData/stockSalesCosts.d.ts
View file @
4d5d769e
import
{
Document
}
from
'../../../domain/project'
export
interface
StockSalesCosts
{
export
interface
BD
StockSalesCosts
{
document
?:
Document
monthYearReference
:
string
salesCommission
:
string
...
...
@@ -9,10 +9,10 @@ export interface StockSalesCosts {
interface
InputUpdateBDStockSalesCosts
{
projectId
:
string
stockSalesCosts
:
StockSalesCosts
stockSalesCosts
:
BD
StockSalesCosts
}
export
interface
UpdateBDStockSalesCosts
{
Input
:
InputUpdateBDStockSalesCosts
Output
:
StockSalesCosts
Output
:
BD
StockSalesCosts
}
cli/web/cliente/src/api/domain/proposalData/involvedPeople/identification.d.ts
View file @
4d5d769e
...
...
@@ -7,9 +7,9 @@ export interface InvolvedPerson {
sourceIncome
?:
SourceIncome
address
?:
InvolvedPersonAddress
home
?:
Home
//
spousePersonalData?: SpousePersonalData
//
vehicles?: Vehicle[]
//
references?: Reference[]
spousePersonalData
?:
SpousePersonalData
vehicles
?:
Vehicle
[]
references
?:
Reference
[]
}
export
interface
Identification
{
...
...
@@ -45,3 +45,23 @@ export interface AddCDIdentification {
Input
:
InputAddCDIdentification
Output
:
Identification
}
interface
InputUpdateCDIdentification
{
identification
:
Identification
projectId
:
string
personId
:
string
}
export
interface
UpdateCDIdentification
{
Input
:
InputUpdateCDIdentification
Output
:
Identification
}
interface
InputGetCDIdentification
{
projectId
:
string
}
export
interface
GetCDIdentification
{
Input
:
InputGetCDIdentification
Output
?:
Identification
}
cli/web/cliente/src/api/domain/proposalData/involvedPeople/index.d.ts
View file @
4d5d769e
import
type
{
IPAddress
}
from
'./address'
import
type
{
InvolvedPerson
}
from
'./identification'
export
*
from
'./identification'
export
*
from
'./personalData'
...
...
@@ -15,3 +16,13 @@ export interface RG {
number
:
string
dispatcherAgency
:
string
}
interface
InputGetCustomerData
{
projectId
:
string
personId
:
string
}
export
interface
GetCustomerData
{
Input
:
InputGetCustomerData
Output
:
InvolvedPerson
}
cli/web/cliente/src/api/domain/schedule.d.ts
0 → 100644
View file @
4d5d769e
import
{
Entity
}
from
'@agiliza/utils/method'
import
{
Document
,
Operation
}
from
'./project'
export
interface
Schedule
extends
Entity
{
status
:
ScheduleStatus
events
:
string
[]
documents
?:
Document
[]
number
:
string
date
:
Date
// user: UserClient
// complement?: ScheduleVisitComplement
// details?: ScheduleDetails
idProject
?:
string
}
interface
ScheduleDetails
{
rescheduleDate
?:
Date
reason
:
string
justification
:
string
}
export
interface
SchedulePermissions
{
requestCancel
?:
boolean
requestReschedule
?:
boolean
confirmReschedule
?:
boolean
confirmRequest
?:
boolean
goToProject
?:
boolean
cancelVisit
?:
boolean
confirmCancel
?:
boolean
}
export
interface
ScheduleCancellationReason
extends
Entity
{
description
:
string
}
export
interface
RescheduleReason
extends
Entity
{
description
:
string
}
export
interface
ScheduleStatus
extends
Entity
{
description
:
string
operations
:
Operation
[]
}
interface
ScheduleVisitComplement
{
address
:
VisitAddress
interestCredit
:
CreditInformation
}
export
interface
VisitAddress
{
id
:
string
street
:
string
number
:
string
cep
:
string
complement
:
string
city
:
string
district
:
string
state
:
string
}
export
interface
CreditInformation
{
creditValue
:
number
creditObjective
:
string
creditInstallment
:
number
creditGracePeriod
:
string
}
export
interface
ScheduleCancellation
{
scheduleId
:
string
reason
:
string
justification
:
string
}
export
interface
Reschedule
{
scheduleId
:
string
dateTime
:
Date
reason
:
string
justification
:
string
}
export
interface
ScheduleContext
{
gracePeriods
:
CreditGracePeriod
[]
installments
:
CreditInstallment
[]
}
export
interface
CreditInstallment
extends
Entity
{
description
:
string
}
// Carência
export
interface
CreditGracePeriod
extends
Entity
{
description
:
string
}
cli/web/cliente/src/api/domain/simulation/simulation.d.ts
View file @
4d5d769e
...
...
@@ -7,6 +7,15 @@ export interface SubProduct extends Entity {
maxAmountInstallment
?:
number
installementOptions
:
InstallmentOption
[]
TAC
?:
number
monthlyCET
?:
number
yearlyCET
?:
number
totalLiberateLiquidValue
?:
number
loanValue
?:
number
baseCalcDate
?:
Date
amortization
?:
number
graceInstallementAmount
?:
number
totalCalcValue
?:
number
feeTotalValue
?:
number
}
export
interface
GetSubProducts
{
...
...
cli/web/cliente/src/api/mappers/api/proposalData/businessData.ts
View file @
4d5d769e
...
...
@@ -2,10 +2,10 @@ import {
AddBDProductService
,
BDAddress
,
BDProductService
,
BDStockSalesCosts
,
BusinessData
,
CreateProposal
,
Document
,
StockSalesCosts
,
UpdateBDAddress
,
UpdateBDIdentification
,
UpdateBDProductService
,
...
...
@@ -150,12 +150,12 @@ export class BDUpdateAddressApiMapper implements ApiAdapter<UpdateBDAddress['Inp
})
}
export
class
BDStockSalesCostsApiAdapter
implements
ApiAdapter
<
StockSalesCosts
,
DadosNegocioEstoqueVendasCustosApiModel
>
{
export
class
BDStockSalesCostsApiAdapter
implements
ApiAdapter
<
BD
StockSalesCosts
,
DadosNegocioEstoqueVendasCustosApiModel
>
{
private
documentApiAdapter
:
DocumentApiMapper
constructor
()
{
this
.
documentApiAdapter
=
new
DocumentApiMapper
()
}
public
mapDomainToApiModel
=
(
sSC
:
StockSalesCosts
):
DadosNegocioEstoqueVendasCustosApiModel
=>
({
public
mapDomainToApiModel
=
(
sSC
:
BD
StockSalesCosts
):
DadosNegocioEstoqueVendasCustosApiModel
=>
({
classificacaoMes
:
sSC
.
monthRating
,
comissaoVendas
:
Number
(
sSC
.
salesCommission
),
documento
:
sSC
.
document
&&
this
.
documentApiAdapter
.
mapDomainToApiModel
(
sSC
.
document
),
...
...
cli/web/cliente/src/api/mappers/api/proposalData/customerData.tsx
View file @
4d5d769e
...
...
@@ -11,6 +11,7 @@ import {
SpousePersonalData
,
UpdateCDAddress
,
UpdateCDHome
,
UpdateCDIdentification
,
UpdateCDPersonalData
,
UpdateCDReference
,
UpdateCDSourceIncome
,
...
...
@@ -18,6 +19,7 @@ import {
UpdateCDVehicle
,
Vehicle
}
from
'@agiliza/api/domain'
import
{
INVOLVED_PERSON_NAMES
,
INVOLVED_PERSON_TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
extractNumbers
}
from
'@agiliza/utils/method'
import
{
EnderecoApiModel
,
...
...
@@ -37,6 +39,7 @@ import {
AtualizarDadosPessoaisPessoaEnvolvidaRequest
,
AtualizarEnderecoPessoaEnvolvidaRequest
,
AtualizarFonteRendaPessoaEnvolvidaRequest
,
AtualizarIdentificacaoPessoaEnvolvidaRequest
,
AtualizarVeiculoPessoaEnvolvidaRequest
,
CriarReferenciaPessoaEnvolvidaRequest
,
CriarVeiculoPessoaEnvolvidaRequest
,
...
...
@@ -65,7 +68,7 @@ export class AddInvolvedPersonIdentification implements ApiAdapter<InvolvedPerso
nome
:
domain
.
name
,
cpfcnpj
:
extractNumbers
(
domain
.
cpfcnpj
),
sexo
:
domain
.
gender
,
tipo
:
domain
.
type
,
tipo
:
domain
.
type
===
INVOLVED_PERSON_NAMES
[
'2'
]
?
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]
:
''
,
contaBanestes
:
domain
.
account
?
this
.
mapBanestesAccountToApi
(
domain
.
account
)
:
undefined
,
dadosTipo
:
domain
.
dataType
?
this
.
mapDateTypeToApi
(
domain
.
dataType
)
:
undefined
,
})
...
...
@@ -83,6 +86,19 @@ export class CDAddIdentificationMapper implements ApiAdapter<AddCDIdentification
},
})
}
export
class
CDUpdateIdentificationMapper
implements
ApiAdapter
<
UpdateCDIdentification
[
'Input'
],
AtualizarIdentificacaoPessoaEnvolvidaRequest
>
{
private
identificationApiMapper
:
AddInvolvedPersonIdentification
constructor
()
{
this
.
identificationApiMapper
=
new
AddInvolvedPersonIdentification
()
}
public
mapDomainToApiModel
=
(
input
:
UpdateCDIdentification
[
'Input'
]):
AtualizarIdentificacaoPessoaEnvolvidaRequest
=>
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
,
pessoaEnvolvidaIdentificacaoRequestApiModel
:
{
identificacao
:
this
.
identificationApiMapper
.
mapDomainToApiModel
(
input
.
identification
),
},
})
}
export
class
RGApiAdapter
implements
ApiAdapter
<
RG
,
ProjetoPessoaEnvolvidaRGApiModel
>
{
public
mapDomainToApiModel
=
(
rg
:
RG
):
ProjetoPessoaEnvolvidaRGApiModel
=>
({
...
...
cli/web/cliente/src/api/mappers/domain/index.ts
View file @
4d5d769e
...
...
@@ -2,10 +2,20 @@ import * as AuthenticationMappers from './authentication'
import
*
as
ContextMappers
from
'./context'
import
*
as
CustomerMappers
from
'./customer'
import
*
as
ErrorMappers
from
'./error'
import
*
as
ProjectMappers
from
'./project'
import
*
as
ProposalDataMappers
from
'./proposalData'
import
*
as
SessionAdapters
from
'./session'
import
*
as
SimulationMappers
from
'./simulation'
export
{
ContextMappers
,
ErrorMappers
,
SessionAdapters
,
SimulationMappers
,
AuthenticationMappers
,
CustomerMappers
,
ProposalDataMappers
}
export
{
ContextMappers
,
ErrorMappers
,
SessionAdapters
,
SimulationMappers
,
AuthenticationMappers
,
CustomerMappers
,
ProposalDataMappers
,
ProjectMappers
,
}
export
*
from
'./shared'
cli/web/cliente/src/api/mappers/domain/project.ts
0 → 100644
View file @
4d5d769e
import
{
Document
,
Operation
,
Project
,
ProjectStatus
}
from
'@agiliza/api/domain/project'
import
{
DocumentoApiModel
,
ProjetoClienteApiModel
,
ProjetoOperacaoApiModel
,
ProjetoSituacaoApiModel
,
ProjetoSituacaoCompletoApiModel
}
from
'@microcredito/client'
import
{
ScheduleAdapter
}
from
'./schedule'
import
{
DomainAdapter
}
from
'./shared'
export
class
ProjectMapper
implements
DomainAdapter
<
ProjetoClienteApiModel
,
Project
>
{
private
statusAdapter
:
ProjectStatusAdapter
private
scheduleAdapter
:
ScheduleAdapter
private
documentAdapter
:
ProjectDocumentMapper
// private userCustomerAdapter: UserCustomerMapper
constructor
()
{
this
.
scheduleAdapter
=
new
ScheduleAdapter
()
this
.
statusAdapter
=
new
ProjectStatusAdapter
()
this
.
documentAdapter
=
new
ProjectDocumentMapper
()
// this.userCustomerAdapter = new UserCustomerMapper()
}
public
mapApiModelToDomain
=
(
apimodel
:
ProjetoClienteApiModel
)
=>
{
const
result
:
Project
=
{
// customer: this.userCustomerAdapter.mapApiModelToDomain(apimodel.cliente),
processNumber
:
apimodel
.
numeroProcesso
,
events
:
apimodel
.
eventos
??
[],
id
:
apimodel
.
id
,
status
:
this
.
statusAdapter
.
mapApiModelToDomain
(
apimodel
.
situacao
),
schedules
:
apimodel
?.
agendamentos
?.
map
(
this
.
scheduleAdapter
.
mapApiModelToDomain
),
documents
:
apimodel
.
documentos
.
map
(
this
.
documentAdapter
.
mapApiModelToDomain
),
}
return
result
}
}
// TODO: mudar spec para corrigir status de Visita e Projeto
export
class
ProjectStatusAdapter
implements
DomainAdapter
<
ProjetoSituacaoCompletoApiModel
,
ProjectStatus
>
{
public
mapOperacaoToDomain
=
(
oprt
:
ProjetoOperacaoApiModel
):
Operation
=>
({
id
:
oprt
.
codigo
,
description
:
oprt
.
descricao
,
descriptionTransition
:
oprt
.
descricaoTransicao
,
permission
:
oprt
.
permissao
===
'cliente'
?
'customer'
:
'broker'
,
})
public
mapApiModelToDomain
=
(
apimodel
:
ProjetoSituacaoCompletoApiModel
)
=>
{
const
result
:
ProjectStatus
=
{
id
:
apimodel
.
codigo
,
description
:
apimodel
.
descricao
,
operations
:
apimodel
.
operacoes
?.
map
(
this
.
mapOperacaoToDomain
),
}
return
result
}
}
export
class
ProjectDocumentMapper
implements
DomainAdapter
<
DocumentoApiModel
,
Document
>
{
public
mapTipoDocumentoApiToDomain
=
(
tipo
:
DocumentoApiModel
[
'tipoDocumento'
]):
Document
[
'type'
]
=>
({
id
:
tipo
.
codigo
,
description
:
tipo
.
descricao
,
})
public
mapApiModelToDomain
=
(
apimodel
:
DocumentoApiModel
):
Document
=>
({
id
:
apimodel
.
id
,
url
:
apimodel
.
imagem
,
type
:
this
.
mapTipoDocumentoApiToDomain
(
apimodel
.
tipoDocumento
),
extraInformations
:
apimodel
.
informacoesComplementares
||
''
,
})
}
export
class
ProjectContextStatusMapper
implements
DomainAdapter
<
ProjetoSituacaoApiModel
,
ProjectStatus
>
{
public
mapApiModelToDomain
=
(
situacao
:
ProjetoSituacaoApiModel
):
ProjectStatus
=>
({
id
:
situacao
.
codigo
,
description
:
situacao
.
descricao
,
})
}
cli/web/cliente/src/api/mappers/domain/proposalData/businessData.ts
View file @
4d5d769e
import
{
BDIdentification
,
BDProductService
,
BDStockSalesCosts
,
BusinessData
,
Document
,
StockSalesCosts
,
UpdateBDAddress
}
from
'@agiliza/api/domain'
import
{
...
...
@@ -80,16 +81,41 @@ export class BDUpdateAddressMapper implements DomainAdapter<DadosNegocioEndereco
})
}
export
class
BDUpdateStockSalesCostsMapper
implements
DomainAdapter
<
DadosNegocioEstoqueVendasCustosApiModel
,
StockSalesCosts
>
{
export
class
BDUpdateStockSalesCostsMapper
implements
DomainAdapter
<
DadosNegocioEstoqueVendasCustosApiModel
,
BD
StockSalesCosts
>
{
private
documentMapper
:
ProjectDocumentMapper
constructor
()
{
this
.
documentMapper
=
new
ProjectDocumentMapper
()
}
public
mapApiModelToDomain
=
(
sSC
:
DadosNegocioEstoqueVendasCustosApiModel
):
StockSalesCosts
=>
({
public
mapApiModelToDomain
=
(
sSC
:
DadosNegocioEstoqueVendasCustosApiModel
):
BD
StockSalesCosts
=>
({
document
:
sSC
.
documento
&&
this
.
documentMapper
.
mapApiModelToDomain
(
sSC
.
documento
),
monthRating
:
sSC
.
classificacaoMes
||
''
,
monthYearReference
:
sSC
.
mesAnoReferencia
||
''
,
salesCommission
:
sSC
.
comissaoVendas
?.
toString
()
||
''
,
})
}
export
interface
DadosNegocio
{
identificacao
?:
DadosNegocioIdentificacaoApiModel
endereco
?:
DadosNegocioEnderecoApiModel
estoqueVendasCustos
?:
DadosNegocioEstoqueVendasCustosApiModel
produtosServicos
?:
DadosNegocioProdutoServicoApiModel
[]
}
export
class
BDGetBusinessDataMapper
implements
DomainAdapter
<
DadosNegocio
,
BusinessData
>
{
private
identificationMapper
:
BDIdentificationMapper
private
addressMapper
:
BDUpdateAddressMapper
private
productServicesMapper
:
BDProductsServicesMapper
private
stockSalesCostsMapper
:
BDUpdateStockSalesCostsMapper
constructor
()
{
this
.
identificationMapper
=
new
BDIdentificationMapper
()
this
.
addressMapper
=
new
BDUpdateAddressMapper
()
this
.
productServicesMapper
=
new
BDProductsServicesMapper
()
this
.
stockSalesCostsMapper
=
new
BDUpdateStockSalesCostsMapper
()
}
public
mapApiModelToDomain
=
(
dN
:
DadosNegocio
):
BusinessData
=>
({
identification
:
dN
.
identificacao
&&
this
.
identificationMapper
.
mapApiModelToDomain
(
dN
.
identificacao
),
address
:
dN
.
endereco
&&
this
.
addressMapper
.
mapApiModelToDomain
(
dN
.
endereco
),
productsServices
:
dN
.
produtosServicos
&&
dN
.
produtosServicos
.
map
(
this
.
productServicesMapper
.
mapApiModelToDomain
),
stockSalesCosts
:
dN
.
estoqueVendasCustos
&&
this
.
stockSalesCostsMapper
.
mapApiModelToDomain
(
dN
.
estoqueVendasCustos
),
})
}
cli/web/cliente/src/api/mappers/domain/proposalData/customerData.ts
View file @
4d5d769e
...
...
@@ -221,3 +221,58 @@ export class VehicleMapper implements DomainAdapter<ProjetoPessoaEnvolvidaVeicul
year
:
vcl
.
ano
?
vcl
.
ano
.
toString
()
:
''
,
})
}
// export interface InvolvedPerson {
// id: string
// identification: Identification
// personalData?: PersonalData
// sourceIncome?: SourceIncome
// address?: InvolvedPersonAddress
// home?: Home
// spousePersonalData?: SpousePersonalData
// vehicles?: Vehicle[]
// references?: Reference[]
// }
export
interface
DadosCliente
{
identificacao
:
ProjetoPessoaEnvolvidaIdentificacaoApiModel
dadosPessoais
:
ProjetoPessoaEnvolvidaDadosPessoaisApiModel
fonteRenda
:
ProjetoPessoaEnvolvidaFonteRendaApiModel
endereco
:
ProjetoPessoaEnvolvidaEnderecoApiModel
dadosMoradia
:
ProjetoPessoaEnvolvidaDadosMoradiaApiModel
conjuge
:
ProjetoPessoaEnvolvidaConjugeApiModel
&
ProjetoPessoaEnvolvidaConjugeDadosAdicionaisApiModel
veiculos
:
ProjetoPessoaEnvolvidaVeiculoApiModel
[]
referencias
:
ProjetoPessoaEnvolvidaReferenciaApiModel
[]
}
export
class
GetCustomerDataMapper
implements
DomainAdapter
<
DadosCliente
,
InvolvedPerson
>
{
private
identificationMapper
:
CDIdentificationAdapter
private
personalDataMapper
:
CDPersonalDataMapper
private
sourceIncomeMapper
:
CDSourceIncomeAdapter
private
addresseMapper
:
CDUpdateAddressMapper
private
homeMapper
:
CDUpdateHomeMapper
private
referenceMapper
:
ReferenceMapper
private
spouseMapper
:
CDUpdateSpouseDataMapper
private
vehicleMapper
:
VehicleMapper
constructor
()
{
this
.
identificationMapper
=
new
CDIdentificationAdapter
()
this
.
personalDataMapper
=
new
CDPersonalDataMapper
()
this
.
sourceIncomeMapper
=
new
CDSourceIncomeAdapter
()
this
.
addresseMapper
=
new
CDUpdateAddressMapper
()
this
.
homeMapper
=
new
CDUpdateHomeMapper
()
this
.
referenceMapper
=
new
ReferenceMapper
()
this
.
spouseMapper
=
new
CDUpdateSpouseDataMapper
()
this
.
vehicleMapper
=
new
VehicleMapper
()
}
public
mapApiModelToDomain
=
(
dC
:
DadosCliente
):
InvolvedPerson
=>
({
id
:
dC
.
identificacao
.
id
||
''
,
identification
:
this
.
identificationMapper
.
mapApiModelToDomain
(
dC
.
identificacao
),
personalData
:
this
.
personalDataMapper
.
mapApiModelToDomain
(
dC
.
dadosPessoais
),
sourceIncome
:
this
.
sourceIncomeMapper
.
mapApiModelToDomain
(
dC
.
fonteRenda
),
address
:
this
.
addresseMapper
.
mapApiModelToDomain
(
dC
.
endereco
),
home
:
this
.
homeMapper
.
mapApiModelToDomain
(
dC
.
dadosMoradia
),
spousePersonalData
:
this
.
spouseMapper
.
mapApiModelToDomain
(
dC
.
conjuge
),
vehicles
:
dC
.
veiculos
.
map
(
this
.
vehicleMapper
.
mapApiModelToDomain
),
references
:
dC
.
referencias
.
map
(
this
.
referenceMapper
.
mapApiModelToDomain
),
})
}
cli/web/cliente/src/api/mappers/domain/schedule.ts
0 → 100644
View file @
4d5d769e
import
{
CreditGracePeriod
,
CreditInformation
,
CreditInstallment
,
Event
,
Operation
,
RescheduleReason
,
Schedule
,
ScheduleCancellationReason
,
ScheduleContext
,
ScheduleStatus
,
VisitAddress
}
from
'@agiliza/api/domain'
import
{
AgendamentoDadosCreditoInteresseApiModel
,
AgendamentoVisitaClienteApiModel
,
AgendamentoVisitaOperacaoApiModel
,
AgendamentoVisitaSituacaoApiModel
,
AgendamentoVisitaSituacaoCompletoApiModel
,
ContextoVisitaResponseApiModel
,
CreditoCarenciaApiModel
,
EnderecoApiModel
,
EventoVisitaApiModel
,
MotivoCancelamentoApiModel
,
MotivoReagendamentoApiModel
}
from
'@microcredito/client'
import
{
ProjectDocumentMapper
}
from
'./project'
import
{
DomainAdapter
}
from
'./shared'
export
class
CreditInformationAdapter
implements
DomainAdapter
<
AgendamentoDadosCreditoInteresseApiModel
,
CreditInformation
>
{
public
mapApiModelToDomain
=
(
apimodel
:
AgendamentoDadosCreditoInteresseApiModel
):
CreditInformation
=>
({
creditValue
:
apimodel
.
valor
,
creditInstallment
:
apimodel
.
numeroParcelas
,
creditObjective
:
apimodel
.
objetivo
,
creditGracePeriod
:
apimodel
.
carencia
,
})
}
export
class
VisitAddressAdapter
implements
DomainAdapter
<
EnderecoApiModel
,
VisitAddress
>
{
public
mapApiModelToDomain
=
(
apimodel
:
EnderecoApiModel
):
VisitAddress
=>
({
id
:
apimodel
.
id
||
''
,
cep
:
apimodel
.
cep
,
city
:
apimodel
.
municipio
,
state
:
apimodel
.
estado
,
complement
:
apimodel
.
complemento
||
''
,
district
:
apimodel
.
bairro
,
number
:
apimodel
.
numero
,
street
:
apimodel
.
logradouro
,
})
}
type
Agendamento
=
Omit
<
AgendamentoVisitaClienteApiModel
,
'creditoInteresse'
|
'enderecoVisita'
>
export
class
ScheduleAdapter
implements
DomainAdapter
<
Agendamento
,
Schedule
>
{
// private userClientMapper: UserClientMapper
// private addressAdapter: VisitAddressAdapter
// private creditInformationAdapter: CreditInformationAdapter
private
statusAdapter
:
ScheduleStatusAdapter
private
documentAdapter
:
ProjectDocumentMapper
constructor
()
{
// this.userClientMapper = new UserClientMapper()
// this.addressAdapter = new VisitAddressAdapter()
// this.creditInformationAdapter = new CreditInformationAdapter()
this
.
statusAdapter
=
new
ScheduleStatusAdapter
()
this
.
documentAdapter
=
new
ProjectDocumentMapper
()
}
public
mapApiModelToDomain
=
(
agendamento
:
Agendamento
):
Schedule
=>
{
const
result
:
Schedule
=
{
id
:
agendamento
.
id
||
''
,
number
:
agendamento
.
numero
,
date
:
agendamento
.
data
,
events
:
agendamento
.
eventos
,
documents
:
agendamento
.
documentos
.
map
(
this
.
documentAdapter
.
mapApiModelToDomain
),
status
:
this
.
statusAdapter
.
mapApiModelToDomain
(
agendamento
.
situacao
),
// user: this.userClientMapper.mapApiModelToDomain(agendamento.cliente),
// complement: agendamento.enderecoVisita
// ? {
// address: this.addressAdapter.mapApiModelToDomain(agendamento.enderecoVisita),
// interestCredit: agendamento.creditoInteresse && this.creditInformationAdapter.mapApiModelToDomain(agendamento.creditoInteresse),
// }
// : ({} as any),
// details: agendamento.solicitacaoReagendamento
// ? {
// rescheduleDate: agendamento.solicitacaoReagendamento.dataReagendamento,
// reason: agendamento.solicitacaoReagendamento.codigoMotivo,
// justification: agendamento.solicitacaoReagendamento.justificativa,
// }
// : agendamento.solicitacaoCancelamento
// ? {
// reason: agendamento.solicitacaoCancelamento.codigoMotivo,
// justification: agendamento.solicitacaoCancelamento.justificativa,
// }
// : ({} as any),
}
return
result
}
}
export
class
ScheduleStatusAdapter
implements
DomainAdapter
<
AgendamentoVisitaSituacaoApiModel
,
ScheduleStatus
>
{
private
scheduleOperationAdapter
:
ScheduleOperationAdapter
constructor
()
{
this
.
scheduleOperationAdapter
=
new
ScheduleOperationAdapter
()
}
public
mapApiModelToDomain
=
(
apimodel
:
AgendamentoVisitaSituacaoApiModel
):
ScheduleStatus
=>
{
const
situacao
=
apimodel
as
AgendamentoVisitaSituacaoCompletoApiModel
const
result
:
ScheduleStatus
=
{
id
:
situacao
.
codigo
||
''
,
description
:
situacao
.
descricao
,
operations
:
situacao
.
operacoes
?.
filter
((
op
)
=>
op
.
permissao
!==
'cliente'
).
map
(
this
.
scheduleOperationAdapter
.
mapApiModelToDomain
)
??
[],
}
return
result
}
}
export
class
ScheduleOperationAdapter
implements
DomainAdapter
<
AgendamentoVisitaOperacaoApiModel
,
Operation
>
{
public
mapApiModelToDomain
=
(
operacao
:
AgendamentoVisitaOperacaoApiModel
):
Operation
=>
({
id
:
operacao
.
codigo
,
description
:
operacao
.
descricao
,
descriptionTransition
:
operacao
.
descricaoTransicao
,
permission
:
operacao
.
permissao
===
'cliente'
?
'customer'
:
'broker'
,
})
}
export
class
RescheduleReasonAdapter
implements
DomainAdapter
<
MotivoReagendamentoApiModel
,
RescheduleReason
>
{
public
mapApiModelToDomain
=
(
apimodel
:
MotivoReagendamentoApiModel
):
RescheduleReason
=>
({
id
:
apimodel
.
codigo
,
description
:
apimodel
.
descricao
,
})
}
export
class
ScheduleCancellationReasonAdapter
implements
DomainAdapter
<
MotivoCancelamentoApiModel
,
ScheduleCancellationReason
>
{
public
mapApiModelToDomain
=
(
apimodel
:
MotivoCancelamentoApiModel
):
ScheduleCancellationReason
=>
({
id
:
apimodel
.
codigo
,
description
:
apimodel
.
descricao
,
})
}
export
class
VisitEventAdapter
implements
DomainAdapter
<
EventoVisitaApiModel
,
Event
>
{
public
mapApiModelToDomain
=
(
apimodel
:
EventoVisitaApiModel
):
Event
=>
({
id
:
apimodel
.
id
||
''
,
title
:
apimodel
.
titulo
,
date
:
apimodel
.
data
,
description
:
apimodel
.
descricao
,
})
}
// Parcelas
export
class
CreditInstallmentAdapter
implements
DomainAdapter
<
number
,
CreditInstallment
>
{
public
mapApiModelToDomain
=
(
apimodel
:
number
)
=>
{
const
result
:
CreditInstallment
=
{
id
:
apimodel
.
toString
(),
description
:
apimodel
.
toString
(),
}
return
result
}
}
// Carência
export
class
CreditGracePeriodAdapter
implements
DomainAdapter
<
CreditoCarenciaApiModel
,
CreditGracePeriod
>
{
public
mapApiModelToDomain
=
(
apimodel
:
CreditoCarenciaApiModel
)
=>
{
const
result
:
CreditGracePeriod
=
{
id
:
apimodel
.
codigo
,
description
:
apimodel
.
descricao
,
}
return
result
}
}
export
class
ScheduleContextAdapter
implements
DomainAdapter
<
ContextoVisitaResponseApiModel
,
ScheduleContext
>
{
// private objectiveAdapter: CreditObjectiveAdapter
private
gracePeriodAdapter
:
CreditGracePeriodAdapter
private
installmentAdapter
:
CreditInstallmentAdapter
// private dueDateAdapter: CreditDueDateAdapter
// private productAdapter: CreditProductAdapter
constructor
()
{
// this.objectiveAdapter = new CreditObjectiveAdapter()
this
.
gracePeriodAdapter
=
new
CreditGracePeriodAdapter
()
this
.
installmentAdapter
=
new
CreditInstallmentAdapter
()
// this.dueDateAdapter = new CreditDueDateAdapter()
// this.productAdapter = new CreditProductAdapter()
}
public
mapApiModelToDomain
=
(
apimodel
:
ContextoVisitaResponseApiModel
)
=>
{
const
result
:
ScheduleContext
=
{
gracePeriods
:
apimodel
.
carencias
.
map
(
this
.
gracePeriodAdapter
.
mapApiModelToDomain
),
installments
:
apimodel
.
parcelas
.
map
(
this
.
installmentAdapter
.
mapApiModelToDomain
),
}
return
result
}
}
cli/web/cliente/src/api/mappers/domain/simulation/simulation.ts
View file @
4d5d769e
...
...
@@ -14,10 +14,19 @@ export class SubProductMapper implements DomainAdapter<SubprodutoApiModel, SubPr
public
mapApiModelToDomain
=
(
subproduto
:
SubprodutoApiModel
):
SubProduct
=>
({
id
:
subproduto
.
id
||
''
,
description
:
subproduto
.
descricao
,
IOF
:
subproduto
.
iof
,
TAC
:
subproduto
.
tac
,
fee
:
subproduto
.
taxa
,
IOF
:
subproduto
.
valorTotalIOF
,
TAC
:
subproduto
.
valorTarifadeAnaliseDeCredito
,
monthlyCET
:
subproduto
.
taxaCETMensal
,
yearlyCET
:
subproduto
.
taxaCETAnual
,
fee
:
subproduto
.
taxaJuros
,
installementOptions
:
subproduto
.
opcoesPrestacao
?.
map
(
this
.
mapInstallmentOption
)
||
[],
maxAmountInstallment
:
subproduto
.
qntMaxPrestacoes
,
maxAmountInstallment
:
subproduto
.
qtdeParcelas
,
totalLiberateLiquidValue
:
subproduto
.
valorTotalLiberarLiquido
,
loanValue
:
subproduto
.
valorEmprestimo
,
baseCalcDate
:
subproduto
.
dataBaseCalc
,
amortization
:
subproduto
.
sistemaAmortizacao
,
graceInstallementAmount
:
subproduto
.
qtdeParcelasCarencia
,
totalCalcValue
:
subproduto
.
valorTotalCalc
,
feeTotalValue
:
subproduto
.
valorTotalJuros
,
})
}
cli/web/cliente/src/api/mappers/domain/user.ts
0 → 100644
View file @
4d5d769e
import
{
UserClient
,
UserCustomer
}
from
'@agiliza/api/domain'
import
{
AgendamentoDadosClienteApiModel
,
UsuarioClienteApiModel
}
from
'@microcredito/client'
import
{
DomainAdapter
}
from
'./shared'
export
class
UserCustomerMapper
implements
DomainAdapter
<
UsuarioClienteApiModel
,
UserCustomer
|
undefined
>
{
public
mapApiModelToDomain
=
(
apimodel
?:
UsuarioClienteApiModel
):
UserCustomer
|
undefined
=>
{
const
result
:
UserCustomer
|
undefined
=
apimodel
?
{
cpfcnpj
:
apimodel
.
cpfcnpj
,
name
:
apimodel
.
nome
,
phone
:
apimodel
.
celular
,
ownerCPF
:
apimodel
.
cpfResponsavel
,
ownerName
:
apimodel
.
nomeResponsavel
,
address
:
apimodel
.
endereco
?
{
additionalInfo
:
apimodel
.
endereco
.
complemento
,
cep
:
apimodel
.
endereco
.
cep
,
city
:
apimodel
.
endereco
.
municipio
,
state
:
apimodel
.
endereco
.
estado
,
district
:
apimodel
.
endereco
.
bairro
,
number
:
apimodel
.
endereco
.
numero
,
street
:
apimodel
.
endereco
.
logradouro
,
id
:
apimodel
.
endereco
.
id
,
}
:
undefined
,
email
:
apimodel
.
email
,
}
:
undefined
return
result
}
}
export
class
UserClientMapper
implements
DomainAdapter
<
AgendamentoDadosClienteApiModel
,
UserClient
>
{
public
mapApiModelToDomain
=
(
apimodel
:
AgendamentoDadosClienteApiModel
):
UserClient
=>
{
const
result
:
UserClient
=
{
cpfcnpj
:
apimodel
.
cpfcnpj
,
name
:
apimodel
.
nome
,
}
return
result
}
}
cli/web/cliente/src/api/useCases/project.ts
0 → 100644
View file @
4d5d769e
import
{
GetProjects
}
from
'@agiliza/api/domain'
import
{
ClienteApi
,
Configuration
}
from
'@microcredito/client'
import
{
ErrorMappers
,
ProjectMappers
}
from
'../mappers'
import
{
API_URL
,
mapUserAgentToString
,
SESSION_KEY
,
UserAgent
}
from
'./shared'
export
interface
ProjectRepository
{
getProjects
(
input
:
GetProjects
[
'Input'
]):
Promise
<
GetProjects
[
'Output'
]
>
}
export
class
ProjectRepositoryImpl
implements
ProjectRepository
{
private
api
:
ClienteApi
private
errorAdapter
:
ErrorMappers
.
ResponseErrorAdapter
private
projectMapper
:
ProjectMappers
.
ProjectMapper
constructor
(
userAgent
:
string
,
accessToken
:
string
)
{
this
.
errorAdapter
=
new
ErrorMappers
.
ResponseErrorAdapter
()
this
.
projectMapper
=
new
ProjectMappers
.
ProjectMapper
()
this
.
api
=
new
ClienteApi
(
new
Configuration
({
basePath
:
API_URL
,
accessToken
,
headers
:
{
'User-Agent'
:
userAgent
,
},
})
)
}
public
getProjects
=
async
(
input
:
GetProjects
[
'Input'
]):
Promise
<
GetProjects
[
'Output'
]
>
=>
{
try
{
const
projetos
=
await
this
.
api
.
obterAcompanhamentos
()
return
projetos
.
map
(
this
.
projectMapper
.
mapApiModelToDomain
)
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
throw
result
}
}
}
export
class
ProjectRepositoryImplFactory
{
static
create
(
userAgent
:
UserAgent
)
{
const
accessToken
=
localStorage
.
getItem
(
SESSION_KEY
)
||
''
const
repository
=
new
ProjectRepositoryImpl
(
mapUserAgentToString
(
userAgent
),
accessToken
)
return
repository
}
}
cli/web/cliente/src/api/useCases/proposalData/businessData.ts
View file @
4d5d769e
import
{
AddBDProductService
,
GetBDProductsServices
,
GetBusinessData
,
UpdateBDAddress
,
UpdateBDIdentification
,
UpdateBDProductService
,
UpdateBDStockSalesCosts
}
from
'@agiliza/api/domain'
import
{
ErrorMappers
}
from
'@agiliza/api/mappers'
import
{
DadosNegocio
}
from
'@agiliza/api/mappers/domain/proposalData'
import
{
ClienteApi
,
Configuration
}
from
'@microcredito/client'
import
{
ProposalDataApiMappers
,
ProposalDataMappers
}
from
'../../mappers'
...
...
@@ -19,6 +21,7 @@ export interface PDBusinessDataRepository {
updateIdentification
(
input
:
UpdateBDIdentification
[
'Input'
]):
Promise
<
UpdateBDIdentification
[
'Output'
]
>
updateAddress
(
input
:
UpdateBDAddress
[
'Input'
]):
Promise
<
UpdateBDAddress
[
'Output'
]
>
updateStockSalesCosts
(
input
:
UpdateBDStockSalesCosts
[
'Input'
]):
Promise
<
UpdateBDStockSalesCosts
[
'Output'
]
>
getBusinessData
(
input
:
GetBusinessData
[
'Input'
]):
Promise
<
GetBusinessData
[
'Output'
]
>
}
export
class
PDBusinessDataRepositoryImpl
implements
PDBusinessDataRepository
{
...
...
@@ -34,6 +37,8 @@ export class PDBusinessDataRepositoryImpl implements PDBusinessDataRepository {
private
bdUpdateStockSalesCostsApiMapper
:
ProposalDataApiMappers
.
BDUpdateStockSalesCosts
private
bdUpdateStockSalesCostsMapper
:
ProposalDataMappers
.
BDUpdateStockSalesCostsMapper
private
businessDataMapper
:
ProposalDataMappers
.
BDGetBusinessDataMapper
constructor
(
userAgent
:
string
,
accessToken
:
string
)
{
this
.
errorAdapter
=
new
ErrorMappers
.
ResponseErrorAdapter
()
this
.
bdGetServicesProductsMapper
=
new
ProposalDataMappers
.
BDProductsServicesMapper
()
...
...
@@ -46,6 +51,7 @@ export class PDBusinessDataRepositoryImpl implements PDBusinessDataRepository {
this
.
bdUpdateStockSalesCostsApiMapper
=
new
ProposalDataApiMappers
.
BDUpdateStockSalesCosts
()
this
.
bdUpdateStockSalesCostsMapper
=
new
ProposalDataMappers
.
BDUpdateStockSalesCostsMapper
()
this
.
businessDataMapper
=
new
ProposalDataMappers
.
BDGetBusinessDataMapper
()
this
.
api
=
new
ClienteApi
(
new
Configuration
({
basePath
:
API_URL
,
...
...
@@ -57,6 +63,22 @@ export class PDBusinessDataRepositoryImpl implements PDBusinessDataRepository {
)
}
public
getBusinessData
=
async
(
input
:
GetBusinessData
[
'Input'
]):
Promise
<
GetBusinessData
[
'Output'
]
>
=>
{
const
{
projectId
}
=
input
try
{
const
result
:
DadosNegocio
=
{
identificacao
:
await
this
.
api
.
obterIdentificacaoDadosNegocio
({
projetoId
:
projectId
}),
endereco
:
await
this
.
api
.
obterEnderecoDadosNegocio
({
projetoId
:
projectId
}),
produtosServicos
:
await
this
.
api
.
obterProdutosServicosDadosNegocio
({
projetoId
:
projectId
}),
estoqueVendasCustos
:
await
this
.
api
.
obterEstoqueVendasCustosDadosNegocio
({
projetoId
:
projectId
}),
}
return
this
.
businessDataMapper
.
mapApiModelToDomain
(
result
)
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
throw
result
}
}
public
getProductsServices
=
async
(
input
:
GetBDProductsServices
[
'Input'
]):
Promise
<
GetBDProductsServices
[
'Output'
]
>
=>
{
try
{
const
response
=
await
this
.
api
.
obterProdutosServicosDadosNegocio
({
projetoId
:
input
.
projectId
})
...
...
cli/web/cliente/src/api/useCases/proposalData/customerData.ts
View file @
4d5d769e
...
...
@@ -3,16 +3,21 @@ import {
AddCDReference
,
AddCDVehicle
,
CreateProposal
,
GetCDIdentification
,
GetCDReferences
,
GetCDVehicles
,
GetCustomerData
,
UpdateCDAddress
,
UpdateCDHome
,
UpdateCDIdentification
,
UpdateCDPersonalData
,
UpdateCDReference
,
UpdateCDSourceIncome
,
UpdateCDSpouseData
,
UpdateCDVehicle
}
from
'@agiliza/api/domain'
import
{
DadosCliente
}
from
'@agiliza/api/mappers/domain/proposalData'
import
{
INVOLVED_PERSON_NAMES
,
INVOLVED_PERSON_TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
ClienteApi
,
Configuration
}
from
'@microcredito/client'
import
{
ErrorMappers
,
ProposalDataApiMappers
,
ProposalDataMappers
}
from
'../../mappers'
...
...
@@ -21,6 +26,7 @@ import { API_URL, mapUserAgentToString, SESSION_KEY, UserAgent } from '../shared
export
interface
PDCustomerDataDataRepository
{
createProposal
(
input
:
CreateProposal
[
'Input'
]):
Promise
<
CreateProposal
[
'Output'
]
>
addIdentification
(
input
:
AddCDIdentification
[
'Input'
]):
Promise
<
AddCDIdentification
[
'Output'
]
>
updateIdentification
(
input
:
UpdateCDIdentification
[
'Input'
]):
Promise
<
UpdateCDIdentification
[
'Output'
]
>
updatePersonalData
(
input
:
UpdateCDPersonalData
[
'Input'
]):
Promise
<
UpdateCDPersonalData
[
'Output'
]
>
updateAddress
(
input
:
UpdateCDAddress
[
'Input'
]):
Promise
<
UpdateCDAddress
[
'Output'
]
>
updateSourceIncome
(
input
:
UpdateCDSourceIncome
[
'Input'
]):
Promise
<
UpdateCDSourceIncome
[
'Output'
]
>
...
...
@@ -32,13 +38,16 @@ export interface PDCustomerDataDataRepository {
getVehicles
(
input
:
GetCDVehicles
[
'Input'
]):
Promise
<
GetCDVehicles
[
'Output'
]
>
addVehicle
(
input
:
AddCDVehicle
[
'Input'
]):
Promise
<
AddCDVehicle
[
'Output'
]
>
updateVehicle
(
input
:
UpdateCDVehicle
[
'Input'
]):
Promise
<
UpdateCDVehicle
[
'Output'
]
>
getCustomerData
(
input
:
GetCustomerData
[
'Input'
]):
Promise
<
GetCustomerData
[
'Output'
]
>
getIdentification
(
input
:
GetCDIdentification
[
'Input'
]):
Promise
<
GetCDIdentification
[
'Output'
]
>
}
export
class
PDCustomerDataRepositoryImpl
implements
PDCustomerDataDataRepository
{
private
api
:
ClienteApi
private
errorAdapter
:
ErrorMappers
.
ResponseErrorAdapter
private
createProposalApiMapper
:
ProposalDataApiMappers
.
CreateProposalApiMapper
private
cdUpdateIdentificationApiMapper
:
ProposalDataApiMappers
.
CDAddIdentificationMapper
private
cdAddIdentificationApiMapper
:
ProposalDataApiMappers
.
CDAddIdentificationMapper
private
cdUpdateIdentificationApiMapper
:
ProposalDataApiMappers
.
CDUpdateIdentificationMapper
private
cdUpdatePersonalDataApiMapper
:
ProposalDataApiMappers
.
CDUpdatePersonalDataMapper
private
cdIdentificationMapper
:
ProposalDataMappers
.
CDIdentificationAdapter
private
cdPersonalDataMapper
:
ProposalDataMappers
.
CDPersonalDataMapper
...
...
@@ -56,12 +65,14 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
private
cdVehicleMapper
:
ProposalDataMappers
.
VehicleMapper
private
cdAddVehicleApiMapper
:
ProposalDataApiMappers
.
CDAddVehicleApiMapper
private
cdUpdateVehicleApiMapper
:
ProposalDataApiMappers
.
CDUpdateVehicleApiMapper
private
cdGetCustomerDataMapper
:
ProposalDataMappers
.
GetCustomerDataMapper
constructor
(
userAgent
:
string
,
accessToken
:
string
)
{
this
.
errorAdapter
=
new
ErrorMappers
.
ResponseErrorAdapter
()
this
.
createProposalApiMapper
=
new
ProposalDataApiMappers
.
CreateProposalApiMapper
()
this
.
cdIdentificationMapper
=
new
ProposalDataMappers
.
CDIdentificationAdapter
()
this
.
cdUpdateIdentificationApiMapper
=
new
ProposalDataApiMappers
.
CDAddIdentificationMapper
()
this
.
cdAddIdentificationApiMapper
=
new
ProposalDataApiMappers
.
CDAddIdentificationMapper
()
this
.
cdUpdateIdentificationApiMapper
=
new
ProposalDataApiMappers
.
CDUpdateIdentificationMapper
()
this
.
cdUpdatePersonalDataApiMapper
=
new
ProposalDataApiMappers
.
CDUpdatePersonalDataMapper
()
this
.
cdPersonalDataMapper
=
new
ProposalDataMappers
.
CDPersonalDataMapper
()
this
.
cdUpdateAddressApiMapper
=
new
ProposalDataApiMappers
.
CDUpdateAddressApiMapper
()
...
...
@@ -78,6 +89,7 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
this
.
cdVehicleMapper
=
new
ProposalDataMappers
.
VehicleMapper
()
this
.
cdAddVehicleApiMapper
=
new
ProposalDataApiMappers
.
CDAddVehicleApiMapper
()
this
.
cdUpdateVehicleApiMapper
=
new
ProposalDataApiMappers
.
CDUpdateVehicleApiMapper
()
this
.
cdGetCustomerDataMapper
=
new
ProposalDataMappers
.
GetCustomerDataMapper
()
this
.
api
=
new
ClienteApi
(
new
Configuration
({
...
...
@@ -90,9 +102,56 @@ export class PDCustomerDataRepositoryImpl implements PDCustomerDataDataRepositor
)
}
public
getIdentification
=
async
(
input
:
GetCDIdentification
[
'Input'
]):
Promise
<
GetCDIdentification
[
'Output'
]
>
=>
{
try
{
const
pessoasEnvolvidas
=
await
this
.
api
.
obterPessoasEnvolvidas
({
projetoId
:
input
.
projectId
})
const
involvedPeople
=
pessoasEnvolvidas
.
map
(
this
.
cdIdentificationMapper
.
mapApiModelToDomain
)
console
.
log
(
involvedPeople
)
const
identification
=
involvedPeople
.
find
((
pE
)
=>
pE
.
type
===
INVOLVED_PERSON_NAMES
[
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
]])
return
identification
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
throw
result
}
}
public
getCustomerData
=
async
(
input
:
GetCustomerData
[
'Input'
]):
Promise
<
GetCustomerData
[
'Output'
]
>
=>
{
try
{
const
pessoasEnvolvidas
=
await
this
.
api
.
obterPessoasEnvolvidas
({
projetoId
:
input
.
projectId
})
const
identificacao
=
pessoasEnvolvidas
.
find
((
pE
)
=>
pE
.
id
===
input
.
personId
)
!
const
result
:
DadosCliente
=
{
identificacao
,
dadosPessoais
:
await
this
.
api
.
obterDadosPessoaisPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
fonteRenda
:
await
this
.
api
.
obterFonteRendaPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
endereco
:
await
this
.
api
.
obterEnderecoPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
dadosMoradia
:
await
this
.
api
.
obterDadosPessoaEnvolvidaMoradia
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
conjuge
:
{
...(
await
this
.
api
.
obterConjugePessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
})),
...(
await
this
.
api
.
obterConjugeDadosAdicionaisPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
})),
},
veiculos
:
await
this
.
api
.
obterVeiculosPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
referencias
:
await
this
.
api
.
obterReferenciasPessoaEnvolvida
({
projetoId
:
input
.
projectId
,
pessoaId
:
input
.
personId
}),
}
return
this
.
cdGetCustomerDataMapper
.
mapApiModelToDomain
(
result
)
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
throw
result
}
}
public
updateIdentification
=
async
(
input
:
UpdateCDIdentification
[
'Input'
]):
Promise
<
UpdateCDIdentification
[
'Output'
]
>
=>
{
try
{
const
response
=
await
this
.
api
.
atualizarIdentificacaoPessoaEnvolvida
(
this
.
cdUpdateIdentificationApiMapper
.
mapDomainToApiModel
(
input
))
return
this
.
cdIdentificationMapper
.
mapApiModelToDomain
(
response
)
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
throw
result
}
}
public
addIdentification
=
async
(
input
:
AddCDIdentification
[
'Input'
]):
Promise
<
AddCDIdentification
[
'Output'
]
>
=>
{
try
{
const
response
=
await
this
.
api
.
incluirPessoaEnvolvida
(
this
.
cd
Update
IdentificationApiMapper
.
mapDomainToApiModel
(
input
))
const
response
=
await
this
.
api
.
incluirPessoaEnvolvida
(
this
.
cd
Add
IdentificationApiMapper
.
mapDomainToApiModel
(
input
))
return
this
.
cdIdentificationMapper
.
mapApiModelToDomain
(
response
)
}
catch
(
e
)
{
const
result
=
await
this
.
errorAdapter
.
mapApiModelToDomain
(
e
)
...
...
cli/web/cliente/src/components/atoms/AuthRoute/index.tsx
View file @
4d5d769e
...
...
@@ -7,10 +7,11 @@ import { isAuthenticated } from '@agiliza/redux/session/selectors'
interface
Props
extends
RouteProps
{
authenticated
:
boolean
redirectTo
?:
string
}
function
AuthRoute
({
authenticated
,
...
props
}:
Props
)
{
return
authenticated
?
<
Route
{
...
props
}
/>
:
<
Redirect
to=
"/login"
/>
function
AuthRoute
({
authenticated
,
redirectTo
,
...
props
}:
Props
)
{
return
authenticated
?
<
Route
{
...
props
}
/>
:
<
Redirect
to=
{
redirectTo
||
'/login'
}
/>
}
const
mapStateToProps
=
(
state
:
StoreState
)
=>
({
...
...
cli/web/cliente/src/components/organisms/PhoneField/PhoneField.tsx
View file @
4d5d769e
...
...
@@ -16,7 +16,7 @@ interface Props extends ExtendedProps {
const
PhoneField
=
(
props
:
Props
)
=>
{
const
{
label
,
value
,
onChange
}
=
props
return
<
TextField
variant=
"outlined"
label=
"Telefone"
value=
{
label
||
maskPhone
(
value
)
}
onChange=
{
onChange
}
inputProps=
{
{
maxLength
:
15
}
}
/>
return
<
TextField
variant=
"outlined"
label=
{
label
||
'Telefone'
}
value=
{
maskPhone
(
value
)
}
onChange=
{
onChange
}
inputProps=
{
{
maxLength
:
15
}
}
/>
}
export
default
withStyles
(
styles
)(
PhoneField
)
cli/web/cliente/src/constants/amortization.ts
0 → 100644
View file @
4d5d769e
export
const
AMORTIZATIONS
=
{
1
:
'Price'
,
2
:
'SAC'
,
3
:
'Livre'
,
}
as
const
cli/web/cliente/src/redux/entities/index.ts
View file @
4d5d769e
...
...
@@ -2,6 +2,7 @@ import authentication, {
initialState
as
authenticationInitState
,
Store
as
AuthenticationState
}
from
'./authentication'
import
project
,
{
initialState
as
projectInitState
,
Store
as
ProjectState
}
from
'./project'
import
proposalData
,
{
initialState
as
proposalDataInitState
,
State
as
ProposalDataState
...
...
@@ -17,6 +18,7 @@ export interface EntitiesState {
simulation
:
SimulationState
authentication
:
AuthenticationState
proposalData
:
ProposalDataState
project
:
ProjectState
}
export
const
initialState
:
EntitiesState
=
{
...
...
@@ -24,6 +26,7 @@ export const initialState: EntitiesState = {
system
:
systemInitState
,
authentication
:
authenticationInitState
,
proposalData
:
proposalDataInitState
,
project
:
projectInitState
,
}
const
reducers
=
{
...
...
@@ -31,6 +34,7 @@ const reducers = {
system
,
authentication
,
proposalData
,
project
,
}
export
default
reducers
cli/web/cliente/src/redux/entities/project/index.ts
0 → 100644
View file @
4d5d769e
import
{
getActionTypes
}
from
'@agiliza/utils/method'
import
*
as
selectors
from
'./selectors'
import
slice
from
'./slice'
export
*
from
'./slice'
const
actions
=
slice
.
actions
const
reducer
=
slice
.
reducer
const
types
=
getActionTypes
(
slice
.
actions
)
export
{
actions
,
types
,
selectors
}
export
default
reducer
cli/web/cliente/src/redux/entities/project/selectors.ts
0 → 100644
View file @
4d5d769e
import
{
createSelector
}
from
'@reduxjs/toolkit'
import
{
Store
}
from
'./slice'
export
const
getAllIds
=
(
key
:
keyof
Store
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
allIds
}
export
const
getById
=
(
key
:
keyof
Store
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
byId
}
export
const
getProjects
=
createSelector
(
getById
(
'projects'
),
getAllIds
(
'projects'
),
(
byId
,
allIds
)
=>
allIds
.
map
((
id
)
=>
byId
[
id
]))
cli/web/cliente/src/redux/entities/project/shared.ts
0 → 100644
View file @
4d5d769e
import
{
normalize
,
schema
}
from
'normalizr'
import
{
Project
}
from
'@agiliza/api/domain'
import
{
NormalizedEntity
}
from
'@agiliza/utils/method'
export
const
PROJECT_PREFIX
=
'entities/project'
export
interface
NormalizedProjects
{
projects
:
NormalizedEntity
<
Project
>
}
const
project
=
new
schema
.
Array
(
new
schema
.
Entity
(
'projects'
))
export
const
normalizeProjects
=
(
sCs
:
Project
[])
=>
{
const
{
entities
}
=
normalize
(
sCs
,
project
)
const
normalizedEntities
=
entities
as
unknown
as
NormalizedProjects
return
normalizedEntities
}
cli/web/cliente/src/redux/entities/project/slice.ts
0 → 100644
View file @
4d5d769e
import
{
GetProjects
,
Project
}
from
'@agiliza/api/domain'
import
{
types
as
fetchTypes
}
from
'@agiliza/redux/useCases/project'
import
{
EntityStore
,
syncAllIds
,
syncById
}
from
'@agiliza/utils/method'
import
{
createSlice
,
PayloadAction
}
from
'@reduxjs/toolkit'
import
{
PREFIX
}
from
'../shared'
import
{
normalizeProjects
}
from
'./shared'
export
interface
Store
{
projects
:
EntityStore
<
Project
>
}
export
const
initialState
:
Store
=
{
projects
:
{
byId
:
{},
allIds
:
[]
},
}
export
default
createSlice
({
name
:
`
${
PREFIX
}
/project`
,
initialState
,
reducers
:
{},
extraReducers
:
{
[
fetchTypes
.
getProjects
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetProjects
[
'Output'
]
>
)
=>
{
const
normalized
=
normalizeProjects
(
action
.
payload
)
state
.
projects
.
byId
=
syncById
(
state
.
projects
,
normalized
.
projects
)
state
.
projects
.
allIds
=
syncAllIds
(
state
.
projects
,
normalized
.
projects
)
},
},
})
cli/web/cliente/src/redux/entities/proposalData/businessData/index.ts
0 → 100644
View file @
4d5d769e
import
{
getActionTypes
}
from
'@agiliza/utils/method'
import
*
as
selectors
from
'./selectors'
import
slice
from
'./slice'
export
*
from
'./slice'
const
actions
=
slice
.
actions
const
reducer
=
slice
.
reducer
const
types
=
getActionTypes
(
slice
.
actions
)
export
{
actions
,
types
,
selectors
}
export
default
reducer
cli/web/cliente/src/redux/entities/proposalData/businessData/selectors.ts
0 → 100644
View file @
4d5d769e
import
{
BusinessData
}
from
'@agiliza/api/domain'
import
{
createSelector
}
from
'@reduxjs/toolkit'
import
{
Store
}
from
'./slice'
export
const
getAllIds
=
(
key
:
keyof
Pick
<
Store
,
'productsServices'
>
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
allIds
}
export
const
getById
=
(
key
:
keyof
Pick
<
Store
,
'productsServices'
>
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
byId
}
export
const
getIdentification
=
(
state
:
Store
)
=>
state
.
identification
export
const
getAddress
=
(
state
:
Store
)
=>
state
.
address
export
const
getStockSalesCosts
=
(
state
:
Store
)
=>
state
.
stockSalesCosts
export
const
getProductsServices
=
createSelector
(
getById
(
'productsServices'
),
getAllIds
(
'productsServices'
),
(
byId
,
allIds
)
=>
allIds
.
map
((
id
)
=>
byId
[
id
])
)
export
const
getBusinessData
=
(
state
:
Store
):
BusinessData
=>
({
identification
:
getIdentification
(
state
),
address
:
getAddress
(
state
),
stockSalesCosts
:
getStockSalesCosts
(
state
),
productsServices
:
getProductsServices
(
state
),
})
cli/web/cliente/src/redux/entities/proposalData/businessData/shared.ts
0 → 100644
View file @
4d5d769e
import
{
normalize
,
schema
}
from
'normalizr'
import
{
BDProductService
}
from
'@agiliza/api/domain'
import
{
NormalizedEntity
}
from
'@agiliza/utils/method'
export
const
PROJECT_PREFIX
=
'entities/project'
export
interface
NormalizedProjects
{
productsServices
:
NormalizedEntity
<
BDProductService
>
}
const
productsServices
=
new
schema
.
Array
(
new
schema
.
Entity
(
'productsServices'
))
export
const
normalizeProductsServices
=
(
pS
:
BDProductService
[])
=>
{
const
{
entities
}
=
normalize
(
pS
,
productsServices
)
const
normalizedEntities
=
entities
as
unknown
as
NormalizedProjects
return
normalizedEntities
}
cli/web/cliente/src/redux/entities/proposalData/businessData/slice.ts
0 → 100644
View file @
4d5d769e
import
{
AddBDProductService
,
BDProductService
,
BusinessData
,
GetBDProductsServices
,
GetBusinessData
,
UpdateBDProductService
}
from
'@agiliza/api/domain'
import
{
types
as
businessDataTypes
}
from
'@agiliza/redux/useCases/proposalData/businessData'
import
{
keys
,
WithEntityStore
}
from
'@agiliza/utils/method'
import
{
createSlice
,
PayloadAction
}
from
'@reduxjs/toolkit'
import
{
PROPOSAL_DATA_PREFIX
}
from
'../shared'
import
{
normalizeProductsServices
}
from
'./shared'
type
ExtendedStore
=
Omit
<
BusinessData
,
'productsServices'
>
&
WithEntityStore
<
Required
<
Pick
<
BusinessData
,
'productsServices'
>>>
export
interface
Store
extends
ExtendedStore
{}
export
const
initialState
:
Store
=
{
identification
:
undefined
,
address
:
undefined
,
stockSalesCosts
:
undefined
,
productsServices
:
{
byId
:
{},
allIds
:
[]
},
}
const
updateProductsServices
=
(
state
:
Store
,
pds
:
BDProductService
[])
=>
{
const
{
productsServices
}
=
normalizeProductsServices
(
pds
)
state
.
productsServices
.
byId
=
productsServices
state
.
productsServices
.
allIds
=
keys
(
productsServices
)
}
export
default
createSlice
({
name
:
`
${
PROPOSAL_DATA_PREFIX
}
/businessData`
,
initialState
,
reducers
:
{},
extraReducers
:
{
[
businessDataTypes
.
getBusinessData
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetBusinessData
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
state
.
identification
=
payload
.
identification
state
.
address
=
payload
.
address
state
.
stockSalesCosts
=
payload
.
stockSalesCosts
if
(
payload
.
productsServices
)
updateProductsServices
(
state
,
payload
.
productsServices
)
},
[
businessDataTypes
.
getProductsServices
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetBDProductsServices
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateProductsServices
(
state
,
payload
)
},
[
businessDataTypes
.
addProductService
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddBDProductService
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateProductsServices
(
state
,
payload
)
},
[
businessDataTypes
.
updateProductService
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateBDProductService
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateProductsServices
(
state
,
payload
)
},
},
})
cli/web/cliente/src/redux/entities/proposalData/customerData/index.ts
0 → 100644
View file @
4d5d769e
import
{
getActionTypes
}
from
'@agiliza/utils/method'
import
*
as
selectors
from
'./selectors'
import
slice
from
'./slice'
export
*
from
'./slice'
const
actions
=
slice
.
actions
const
reducer
=
slice
.
reducer
const
types
=
getActionTypes
(
slice
.
actions
)
export
{
actions
,
types
,
selectors
}
export
default
reducer
cli/web/cliente/src/redux/entities/proposalData/customerData/selectors.ts
0 → 100644
View file @
4d5d769e
import
{
InvolvedPerson
}
from
'@agiliza/api/domain'
import
{
createSelector
}
from
'@reduxjs/toolkit'
import
{
Store
}
from
'./slice'
export
const
getAllIds
=
(
key
:
keyof
Pick
<
Store
,
'vehicles'
|
'references'
>
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
allIds
}
export
const
getById
=
(
key
:
keyof
Pick
<
Store
,
'vehicles'
|
'references'
>
)
=>
(
state
:
Store
)
=>
{
return
state
[
key
].
byId
}
export
const
getIdentification
=
(
state
:
Store
)
=>
state
.
identification
export
const
getAddress
=
(
state
:
Store
)
=>
state
.
address
export
const
getPersonalData
=
(
state
:
Store
)
=>
state
.
personalData
export
const
getHome
=
(
state
:
Store
)
=>
state
.
home
export
const
getSourceIncome
=
(
state
:
Store
)
=>
state
.
sourceIncome
export
const
getSpousePersonalData
=
(
state
:
Store
)
=>
state
.
spousePersonalData
export
const
getVehicles
=
createSelector
(
getById
(
'vehicles'
),
getAllIds
(
'vehicles'
),
(
byId
,
allIds
)
=>
allIds
.
map
((
id
)
=>
byId
[
id
]))
export
const
getReferences
=
createSelector
(
getById
(
'references'
),
getAllIds
(
'references'
),
(
byId
,
allIds
)
=>
allIds
.
map
((
id
)
=>
byId
[
id
]))
export
const
getCustomerData
=
(
state
:
Store
):
Omit
<
InvolvedPerson
,
'id'
>
=>
({
identification
:
getIdentification
(
state
),
address
:
getAddress
(
state
),
personalData
:
getPersonalData
(
state
),
home
:
getHome
(
state
),
sourceIncome
:
getSourceIncome
(
state
),
spousePersonalData
:
getSpousePersonalData
(
state
),
references
:
getReferences
(
state
),
vehicles
:
getVehicles
(
state
),
})
cli/web/cliente/src/redux/entities/proposalData/customerData/shared.ts
0 → 100644
View file @
4d5d769e
import
{
normalize
,
schema
}
from
'normalizr'
import
{
Reference
,
Vehicle
}
from
'@agiliza/api/domain'
import
{
NormalizedEntity
}
from
'@agiliza/utils/method'
export
const
PROJECT_PREFIX
=
'entities/project'
export
interface
NormalizedCustomerData
{
vehicles
:
NormalizedEntity
<
Vehicle
>
references
:
NormalizedEntity
<
Reference
>
}
const
schemas
:
Record
<
keyof
NormalizedCustomerData
,
any
>
=
{
references
:
new
schema
.
Array
(
new
schema
.
Entity
(
'references'
)),
vehicles
:
new
schema
.
Array
(
new
schema
.
Entity
(
'vehicles'
)),
}
export
const
normalizeCustomerData
=
(
vehicles
:
Vehicle
[],
references
:
Reference
[])
=>
{
const
{
entities
}
=
normalize
({
vehicles
,
references
},
schemas
)
const
normalizedEntities
=
entities
as
unknown
as
NormalizedCustomerData
return
normalizedEntities
}
cli/web/cliente/src/redux/entities/proposalData/customerData/slice.ts
0 → 100644
View file @
4d5d769e
import
{
AddCDReference
,
AddCDVehicle
,
GetCDReferences
,
GetCDVehicles
,
GetCustomerData
,
InvolvedPerson
,
Reference
,
UpdateCDReference
,
UpdateCDVehicle
,
Vehicle
}
from
'@agiliza/api/domain'
import
{
INVOLVED_PERSON_TYPES
}
from
'@agiliza/constants/involvedPeople'
import
{
types
as
customerDataTypes
}
from
'@agiliza/redux/useCases/proposalData/customerData'
import
{
keys
,
WithEntityStore
}
from
'@agiliza/utils/method'
import
{
createSlice
,
PayloadAction
}
from
'@reduxjs/toolkit'
import
{
PROPOSAL_DATA_PREFIX
}
from
'../shared'
import
{
normalizeCustomerData
}
from
'./shared'
type
ExtendedStore
=
Omit
<
InvolvedPerson
,
'vehicles'
|
'references'
|
'id'
>
&
WithEntityStore
<
Required
<
Pick
<
InvolvedPerson
,
'vehicles'
|
'references'
>>>
export
interface
Store
extends
ExtendedStore
{}
export
const
initialState
:
Store
=
{
identification
:
{
id
:
''
,
name
:
''
,
cpfcnpj
:
''
,
gender
:
''
,
type
:
INVOLVED_PERSON_TYPES
[
'CUSTOMER'
],
account
:
{
agencyNumber
:
''
,
number
:
''
,
cardPicture
:
''
},
dataType
:
{
doesWithdrawal
:
false
,
framework
:
''
},
},
address
:
undefined
,
personalData
:
undefined
,
home
:
undefined
,
sourceIncome
:
undefined
,
spousePersonalData
:
undefined
,
vehicles
:
{
byId
:
{},
allIds
:
[]
},
references
:
{
byId
:
{},
allIds
:
[]
},
}
const
updateVehiclesReferences
=
(
state
:
Store
,
pds
:
Vehicle
[]
=
[],
rfs
:
Reference
[]
=
[])
=>
{
const
{
vehicles
,
references
}
=
normalizeCustomerData
(
pds
,
rfs
)
state
.
vehicles
.
byId
=
vehicles
state
.
vehicles
.
allIds
=
keys
(
vehicles
)
state
.
references
.
byId
=
references
state
.
references
.
allIds
=
keys
(
references
)
}
export
default
createSlice
({
name
:
`
${
PROPOSAL_DATA_PREFIX
}
/customerData`
,
initialState
,
reducers
:
{},
extraReducers
:
{
[
customerDataTypes
.
getCustomerData
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCustomerData
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
state
.
identification
=
payload
.
identification
state
.
address
=
payload
.
address
state
.
home
=
payload
.
home
state
.
personalData
=
payload
.
personalData
state
.
sourceIncome
=
payload
.
sourceIncome
state
.
spousePersonalData
=
payload
.
spousePersonalData
updateVehiclesReferences
(
state
,
payload
.
vehicles
,
payload
.
references
)
},
[
customerDataTypes
.
getVehicles
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDVehicles
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
payload
)
},
[
customerDataTypes
.
updateReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDVehicle
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
payload
)
},
[
customerDataTypes
.
addReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDVehicle
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
payload
)
},
[
customerDataTypes
.
getReferences
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDReferences
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
[],
payload
)
},
[
customerDataTypes
.
updateReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDReference
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
[],
payload
)
},
[
customerDataTypes
.
addReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDReference
[
'Output'
]
>
)
=>
{
const
{
payload
}
=
action
updateVehiclesReferences
(
state
,
[],
payload
)
},
},
})
cli/web/cliente/src/redux/entities/proposalData/index.ts
View file @
4d5d769e
import
{
combineReducers
}
from
'redux'
import
businessData
,
{
initialState
as
businessDataInitState
,
Store
as
BusinessDataStore
}
from
'./businessData'
import
context
,
{
initialState
as
contextInitState
,
Store
as
ContextStore
}
from
'./context'
import
customerData
,
{
initialState
as
customerDataInitState
,
Store
as
CustomerDataStore
}
from
'./customerData'
import
proposal
,
{
initialState
as
proposalInitState
,
Store
as
ProposalStore
}
from
'./proposal'
export
interface
State
{
context
:
ContextStore
proposal
:
ProposalStore
businessData
:
BusinessDataStore
customerData
:
CustomerDataStore
}
export
const
initialState
:
State
=
{
context
:
contextInitState
,
proposal
:
proposalInitState
,
businessData
:
businessDataInitState
,
customerData
:
customerDataInitState
,
}
export
default
combineReducers
({
export
default
combineReducers
<
State
>
({
context
,
proposal
,
businessData
,
customerData
,
})
cli/web/cliente/src/redux/entities/proposalData/proposal/selectors.ts
View file @
4d5d769e
...
...
@@ -2,6 +2,6 @@ import { Store } from './slice'
export
const
getProposalId
=
(
state
:
Store
)
=>
state
.
proposalId
export
const
getPersonlId
=
(
state
:
Store
)
=>
state
.
personId
export
const
getReferences
=
(
state
:
Store
)
=>
state
.
references
export
const
getVehicles
=
(
state
:
Store
)
=>
state
.
vehicles
export
const
getProductsServices
=
(
state
:
Store
)
=>
state
.
productsServices
//
export const getReferences = (state: Store) => state.references
//
export const getVehicles = (state: Store) => state.vehicles
//
export const getProductsServices = (state: Store) => state.productsServices
cli/web/cliente/src/redux/entities/proposalData/proposal/slice.ts
View file @
4d5d769e
import
{
AddBDProductService
,
AddCDReference
,
AddCDVehicle
,
BDProductService
,
GetBDProductsServices
,
GetCDReferences
,
GetCDVehicles
,
Identification
,
Reference
,
UpdateBDProductService
,
UpdateCDReference
,
UpdateCDVehicle
,
Vehicle
}
from
'@agiliza/api/domain'
import
{
types
as
businessDataTypes
}
from
'@agiliza/redux/useCases/proposalData/businessData'
import
{
Identification
}
from
'@agiliza/api/domain'
import
{
actions
as
uiSimulationActions
}
from
'@agiliza/redux/ui/simulation'
import
{
types
as
customerDataTypes
}
from
'@agiliza/redux/useCases/proposalData/customerData'
import
{
createSlice
,
PayloadAction
}
from
'@reduxjs/toolkit'
...
...
@@ -22,57 +8,38 @@ import { PROPOSAL_DATA_PREFIX } from '../shared'
export
interface
Store
{
proposalId
:
string
personId
:
string
references
:
Reference
[]
vehicles
:
Vehicle
[]
productsServices
:
BDProductService
[]
}
export
const
initialState
:
Store
=
{
proposalId
:
''
,
personId
:
''
,
references
:
[],
vehicles
:
[],
productsServices
:
[],
}
export
default
createSlice
({
name
:
`
${
PROPOSAL_DATA_PREFIX
}
/proposal`
,
initialState
,
reducers
:
{},
reducers
:
{
// setProposalId: (state, action: PayloadAction<string>) => {
// console.log(action)
// state.proposalId = action.payload
// },
},
extraReducers
:
{
[
uiSimulationActions
.
setProposalId
.
toString
()]:
(
state
,
action
:
PayloadAction
<
string
>
)
=>
{
state
.
proposalId
=
action
.
payload
},
[
customerDataTypes
.
createProposal
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
string
>
)
=>
{
state
.
proposalId
=
action
.
payload
},
[
customerDataTypes
.
addIndentification
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Identification
>
)
=>
{
console
.
log
(
action
)
state
.
personId
=
action
.
payload
.
id
},
[
customerDataTypes
.
getReferences
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDReferences
[
'Output'
]
>
)
=>
{
state
.
references
=
action
.
payload
},
[
customerDataTypes
.
addReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDReference
[
'Output'
]
>
)
=>
{
state
.
references
=
action
.
payload
},
[
customerDataTypes
.
updateReference
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDReference
[
'Output'
]
>
)
=>
{
state
.
references
=
action
.
payload
},
[
customerDataTypes
.
getVehicles
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetCDVehicles
[
'Output'
]
>
)
=>
{
state
.
vehicles
=
action
.
payload
},
[
customerDataTypes
.
addVehicle
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddCDVehicle
[
'Output'
]
>
)
=>
{
state
.
vehicles
=
action
.
payload
},
[
customerDataTypes
.
updateVehicle
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateCDVehicle
[
'Output'
]
>
)
=>
{
state
.
vehicles
=
action
.
payload
},
[
businessDataTypes
.
getProductsServices
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
GetBDProductsServices
[
'Output'
]
>
)
=>
{
state
.
productsServices
=
action
.
payload
},
[
businessDataTypes
.
addProductService
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
AddBDProductService
[
'Output'
]
>
)
=>
{
state
.
productsServices
=
action
.
payload
[
customerDataTypes
.
updateIdentification
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Identification
>
)
=>
{
state
.
personId
=
action
.
payload
.
id
},
[
businessDataTypes
.
updateProductService
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
UpdateBDProductService
[
'Output'
]
>
)
=>
{
state
.
productsServices
=
action
.
payload
[
customerDataTypes
.
getIdentification
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Identification
>
)
=>
{
console
.
log
(
action
.
payload
)
state
.
personId
=
action
.
payload
?.
id
},
},
})
cli/web/cliente/src/redux/session/reducer.ts
View file @
4d5d769e
...
...
@@ -25,7 +25,6 @@ const session = createSlice({
[
loginTypes
.
login
.
fulfilled
]:
(
state
,
action
:
PayloadAction
<
Customer
>
)
=>
{
state
.
authenticated
=
true
state
.
customer
=
action
.
payload
console
.
log
(
action
.
payload
)
},
[
loginTypes
.
logout
.
fulfilled
]:
(
state
)
=>
{
state
.
authenticated
=
false
...
...
cli/web/cliente/src/redux/ui/login/slice.ts
View file @
4d5d769e
...
...
@@ -35,9 +35,10 @@ export const actions = {
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
logout
:
createAsyncThunk
(
`
${
prefix
}
/logout`
,
(
_
,
thunkApi
)
=>
{
logout
:
createAsyncThunk
(
`
${
prefix
}
/logout`
,
(
input
:
{
onSuccess
?:
()
=>
void
}
|
void
,
thunkApi
)
=>
{
const
useCase
=
SessionRepositoryImplFactory
.
create
(
appPlatform
)
useCase
.
logout
()
input
?.
onSuccess
&&
input
?.
onSuccess
()
thunkApi
.
dispatch
({
type
:
'RESET_STORE'
})
return
}),
...
...
cli/web/cliente/src/redux/ui/simulation/slice.ts
View file @
4d5d769e
...
...
@@ -15,6 +15,8 @@ const simulation = createSlice({
setData
:
(
state
,
action
:
PayloadAction
<
State
[
'data'
]
>
)
=>
{
state
.
data
=
action
.
payload
},
setProposalId
:
(
state
:
State
,
action
:
PayloadAction
<
string
>
)
=>
{},
setPersonId
:
(
state
:
State
,
action
:
PayloadAction
<
string
>
)
=>
{},
},
})
...
...
cli/web/cliente/src/redux/useCases/index.ts
View file @
4d5d769e
...
...
@@ -2,6 +2,7 @@ import authentication, {
initialState
as
authenticationInitialState
,
State
as
AuthenticationState
}
from
'./authentication'
import
project
,
{
initialState
as
projectsInitialState
,
State
as
ProjectsState
}
from
'./project'
import
proposalData
,
{
initialState
as
proposalDataInitialState
,
State
as
ProposalDataState
...
...
@@ -15,18 +16,21 @@ export interface UseCasesState {
simulation
:
SimulationState
authentication
:
AuthenticationState
proposalData
:
ProposalDataState
project
:
ProjectsState
}
const
reducers
=
{
simulation
,
authentication
,
proposalData
,
project
,
}
export
const
initialState
:
UseCasesState
=
{
simulation
:
simulationInitialState
,
authentication
:
authenticationInitialState
,
proposalData
:
proposalDataInitialState
,
project
:
projectsInitialState
,
}
export
default
reducers
cli/web/cliente/src/redux/useCases/project/index.ts
0 → 100644
View file @
4d5d769e
import
*
as
selectors
from
'./selectors'
import
slice
from
'./slice'
export
*
from
'./slice'
export
{
selectors
}
export
default
slice
.
reducer
cli/web/cliente/src/redux/useCases/project/selectors.ts
0 → 100644
View file @
4d5d769e
import
{
State
}
from
'./slice'
export
const
isFetching
=
(
state
:
State
)
=>
state
.
fetching
cli/web/cliente/src/redux/useCases/project/slice.ts
0 → 100644
View file @
4d5d769e
import
{
ProjectRepositoryImplFactory
}
from
'@agiliza/api/useCases/project'
import
{
appPlatform
}
from
'@agiliza/constants/platform'
import
{
createAsyncReducers
,
getTypesThunkActions
,
values
}
from
'@agiliza/utils/method'
import
{
createAsyncThunk
,
createSlice
}
from
'@reduxjs/toolkit'
const
prefix
=
'useCases/project'
export
interface
State
{
fetching
:
boolean
}
export
const
initialState
:
State
=
{
fetching
:
false
,
}
export
const
actions
=
{
getProjects
:
createAsyncThunk
(
`
${
prefix
}
/getProjects`
,
async
(
_
,
thunkApi
)
=>
{
const
useCase
=
ProjectRepositoryImplFactory
.
create
(
appPlatform
)
try
{
return
await
useCase
.
getProjects
()
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
}
as
const
export
const
types
=
getTypesThunkActions
(
actions
)
export
default
createSlice
({
name
:
prefix
,
initialState
,
reducers
:
{},
extraReducers
:
{
...
values
(
types
).
reduce
((
reducers
,
type
)
=>
({
...
reducers
,
...
createAsyncReducers
(
type
)
}),
{}),
},
})
cli/web/cliente/src/redux/useCases/proposalData/businessData/selectors.ts
View file @
4d5d769e
import
{
State
}
from
'./slice'
export
const
isFetching
=
(
state
:
State
)
=>
state
.
fetching
export
const
isGettingBusinessData
=
(
state
:
State
)
=>
state
.
gettingBusinessData
cli/web/cliente/src/redux/useCases/proposalData/businessData/slice.ts
View file @
4d5d769e
import
{
AddBDProductService
,
GetBDProductsServices
,
GetBusinessData
,
UpdateBDAddress
,
UpdateBDIdentification
,
UpdateBDProductService
,
...
...
@@ -20,10 +21,12 @@ const prefix = 'useCases/businessData'
export
interface
State
{
fetching
:
boolean
gettingBusinessData
}
export
const
initialState
:
State
=
{
fetching
:
false
,
gettingBusinessData
:
false
,
}
export
const
actions
=
{
...
...
@@ -90,6 +93,16 @@ export const actions = {
}
}
),
getBusinessData
:
createAsyncThunk
(
`
${
prefix
}
/getBusinessData`
,
async
(
input
:
WithSuccess
<
GetBusinessData
[
'Input'
]
>
,
thunkApi
)
=>
{
const
useCase
=
PDBusinessDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
response
=
await
useCase
.
getBusinessData
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
()
return
response
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
}
as
const
export
const
types
=
getTypesThunkActions
(
actions
)
...
...
@@ -99,6 +112,7 @@ const login = createSlice({
reducers
:
{},
extraReducers
:
{
...
values
(
types
).
reduce
((
reducers
,
type
)
=>
({
...
reducers
,
...
createAsyncReducers
(
type
)
}),
{}),
...
createAsyncReducers
(
types
.
getBusinessData
,
'gettingBusinessData'
),
},
})
...
...
cli/web/cliente/src/redux/useCases/proposalData/customerData/selectors.ts
View file @
4d5d769e
import
{
State
}
from
'./slice'
export
const
isFetching
=
(
state
:
State
)
=>
state
.
fetching
export
const
isGettingCustomerData
=
(
state
:
State
)
=>
state
.
gettingCustomerData
cli/web/cliente/src/redux/useCases/proposalData/customerData/slice.ts
View file @
4d5d769e
...
...
@@ -3,10 +3,13 @@ import {
AddCDReference
,
AddCDVehicle
,
CreateProposal
,
GetCDIdentification
,
GetCDReferences
,
GetCDVehicles
,
GetCustomerData
,
UpdateCDAddress
,
UpdateCDHome
,
UpdateCDIdentification
,
UpdateCDPersonalData
,
UpdateCDReference
,
UpdateCDSourceIncome
,
...
...
@@ -29,18 +32,20 @@ const prefix = 'useCases/customerData'
export
interface
State
{
fetching
:
boolean
gettingCustomerData
:
boolean
}
export
const
initialState
:
State
=
{
fetching
:
false
,
gettingCustomerData
:
false
,
}
export
const
actions
=
{
createProposal
:
createAsyncThunk
(
`
${
prefix
}
/createProposal`
,
async
(
input
:
WithSuccess
<
CreateProposal
[
'Input'
]
>
,
thunkApi
)
=>
{
createProposal
:
createAsyncThunk
(
`
${
prefix
}
/createProposal`
,
async
(
input
:
WithSuccess
<
CreateProposal
[
'Input'
]
,
string
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
response
=
await
useCase
.
createProposal
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
()
input
.
onSuccess
&&
input
.
onSuccess
(
response
)
return
response
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
...
...
@@ -49,9 +54,19 @@ export const actions = {
addIndentification
:
createAsyncThunk
(
`
${
prefix
}
/addIndentification`
,
async
(
input
:
WithSuccess
<
AddCDIdentification
[
'Input'
]
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
proposal
=
await
useCase
.
addIdentification
(
input
)
const
identification
=
await
useCase
.
addIdentification
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
()
return
identification
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
updateIdentification
:
createAsyncThunk
(
`
${
prefix
}
/updateIdentification`
,
async
(
input
:
WithSuccess
<
UpdateCDIdentification
[
'Input'
]
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
identification
=
await
useCase
.
updateIdentification
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
()
return
proposal
return
identification
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
...
...
@@ -166,6 +181,26 @@ export const actions = {
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
getCustomerData
:
createAsyncThunk
(
`
${
prefix
}
/getCustomerData`
,
async
(
input
:
WithSuccess
<
GetCustomerData
[
'Input'
]
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
response
=
await
useCase
.
getCustomerData
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
()
return
response
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
getIdentification
:
createAsyncThunk
(
`
${
prefix
}
/getIdentification`
,
async
(
input
:
WithSuccess
<
GetCDIdentification
[
'Input'
],
string
>
,
thunkApi
)
=>
{
const
useCase
=
PDCustomerDataRepositoryImplFactory
.
create
(
appPlatform
)
try
{
const
response
=
await
useCase
.
getIdentification
(
input
)
input
.
onSuccess
&&
input
.
onSuccess
(
response
?.
id
||
''
)
return
response
}
catch
(
e
)
{
return
thunkApi
.
rejectWithValue
(
e
)
}
}),
}
as
const
export
const
types
=
getTypesThunkActions
(
actions
)
...
...
@@ -175,6 +210,7 @@ const login = createSlice({
reducers
:
{},
extraReducers
:
{
...
values
(
types
).
reduce
((
reducers
,
type
)
=>
({
...
reducers
,
...
createAsyncReducers
(
type
)
}),
{}),
...
createAsyncReducers
(
types
.
getCustomerData
,
'gettingCustomerData'
),
},
})
...
...
cli/web/cliente/src/views/Login/Login.tsx
View file @
4d5d769e
...
...
@@ -22,10 +22,11 @@ interface Props extends BaseProps {
authenticated
:
boolean
fetching
:
boolean
loginRequest
:
typeof
actions
.
login
redirectTo
?:
string
}
const
Login
=
(
props
:
Props
)
=>
{
const
{
loginRequest
,
authenticated
,
fetching
}
=
props
const
{
loginRequest
,
authenticated
,
fetching
,
redirectTo
}
=
props
const
classes
=
useStyles
()
...
...
@@ -37,7 +38,7 @@ const Login = (props: Props) => {
}
if
(
authenticated
)
{
return
<
Redirect
to=
"/"
/>
return
<
Redirect
to=
{
redirectTo
||
'/'
}
/>
}
return
(
...
...
cli/web/cliente/src/views/Main/Main.tsx
View file @
4d5d769e
import
React
,
{
lazy
,
Suspense
,
useEffect
}
from
'react'
import
React
,
{
lazy
,
Suspense
,
useEffect
,
useState
}
from
'react'
import
{
Redirect
,
Route
,
RouteComponentProps
,
Switch
,
useHistory
}
from
'react-router'
import
AppBar
from
'@agiliza/components/molecules/AppBar'
...
...
@@ -6,8 +6,9 @@ import CircularProgress from '@agiliza/components/molecules/CircularProgress'
import
{
actions
as
drawerActions
}
from
'@agiliza/redux/ui/drawer'
import
{
actions
as
loginActions
}
from
'@agiliza/redux/ui/login'
import
{
ProposalDataRouteState
}
from
'@agiliza/views/ProposalData/pages/ProposalData'
import
{
Typography
}
from
'@material-ui/core'
import
{
Button
,
ListItem
,
ListItemIcon
,
ListItemText
,
Menu
,
Typography
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
AccountCircleOutlined
as
PersonIcon
,
MeetingRoom
as
LogoutIcon
}
from
'@material-ui/icons'
import
connect
,
{
ConnectedProps
}
from
'./connect'
import
{
PATHS
}
from
'./DrawerItems'
...
...
@@ -15,7 +16,7 @@ import styles from './styles'
const
SimulationCreditLines
=
lazy
(()
=>
import
(
'@agiliza/views/SimulationCreditLines/pages/router'
))
const
ProposalData
=
lazy
(()
=>
import
(
'@agiliza/views/ProposalData/pages/ProposalData'
))
const
ListProjects
=
lazy
(()
=>
import
(
'@agiliza/views/Projects/pages/ListProjects
'
))
const
Projects
=
lazy
(()
=>
import
(
'@agiliza/views/Projects/pages/router
'
))
// const SecurityProfile = lazy(() => import('@curio/ui/dist/views/SecurityProfile'))
type
BaseProps
=
RouteComponentProps
&
ConnectedProps
&
WithStyles
<
typeof
styles
>
...
...
@@ -26,41 +27,75 @@ interface Props extends BaseProps {
}
const
Main
=
(
props
:
Props
)
=>
{
const
{
classes
,
toggleDrawer
,
fetchMenu
}
=
props
const
{
classes
,
toggleDrawer
,
fetchMenu
,
customer
}
=
props
const
history
=
useHistory
()
const
[
anchorEl
,
setAnchorEl
]
=
useState
<
null
|
HTMLElement
>
(
null
)
useEffect
(()
=>
{
fetchMenu
()
},
[])
const
handleProfileClick
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
setAnchorEl
(
event
.
currentTarget
)
}
const
handleClose
=
()
=>
{
setAnchorEl
(
null
)
}
const
handleLogout
=
()
=>
{
props
.
logout
({
onSuccess
:
()
=>
{
history
.
push
(
'/'
)
setAnchorEl
(
null
)
},
})
}
return
(
<
div
className=
{
classes
.
pageContainer
}
>
<
AppBar
onNavClick=
{
toggleDrawer
}
title=
{
<
a
onClick=
{
()
=>
history
.
push
(
'/'
)
}
className=
{
classes
.
titleAnchor
}
>
<
Typography
className=
{
classes
.
appTitle
}
>
Agiliza
</
Typography
>
</
a
>
<
div
style=
{
{
display
:
'flex'
}
}
>
<
a
onClick=
{
()
=>
history
.
push
(
'/'
)
}
className=
{
classes
.
titleAnchor
}
>
<
Typography
className=
{
classes
.
appTitle
}
>
Agiliza
</
Typography
>
</
a
>
<
div
style=
{
{
flex
:
1
}
}
/>
<
Button
color=
"inherit"
variant=
"text"
onClick=
{
()
=>
history
.
push
(
PATHS
.
proposals
)
}
>
Retomar proposta
</
Button
>
{
customer
&&
<
Button
onClick=
{
handleProfileClick
}
key=
"1"
color=
"inherit"
endIcon=
{
<
PersonIcon
/>
}
/>
}
</
div
>
}
/>
{
/* <Drawer drawerOpen={drawerOpen} toggleDrawer={toggleDrawer} logout={logout} Items={DrawerItems} {...routeProps} /> */
}
<
Suspense
fallback=
{
<
CircularProgress
/>
}
>
<
Switch
>
<
Route
path=
{
PATHS
.
proposals
}
render=
{
(
rProps
)
=>
<
List
Projects
{
...
rProps
}
/>
}
/>
<
Route
path=
{
PATHS
.
proposals
}
render=
{
(
rProps
)
=>
<
Projects
{
...
rProps
}
/>
}
/>
<
Route
path=
{
PATHS
.
simulation
}
render=
{
(
rProps
)
=>
<
SimulationCreditLines
{
...
rProps
}
/>
}
/>
<
Route
path=
{
PATHS
.
proposalData
}
render=
{
(
rProps
)
=>
{
const
{
location
}
=
rProps
as
RouteComponentProps
<
any
,
any
,
ProposalDataRouteState
>
// if (!location.state) location.state =
{
subproductId
:
'0'
}
if
(
location
.
state
?.
subproduct
Id
)
return
<
ProposalData
{
...
rProps
}
/>
if
(
location
.
state
?.
proposal
Id
)
return
<
ProposalData
{
...
rProps
}
/>
else
return
<
Redirect
from=
{
PATHS
.
proposalData
}
to=
"/"
/>
}
}
/>
<
Redirect
from=
"/"
to=
{
PATHS
.
simulation
}
/>
</
Switch
>
</
Suspense
>
<
Menu
id=
"long-menu"
anchorEl=
{
anchorEl
}
keepMounted
open=
{
Boolean
(
anchorEl
)
}
onClose=
{
handleClose
}
>
<
ListItem
button
onClick=
{
handleLogout
}
>
<
ListItemIcon
>
<
LogoutIcon
/>
</
ListItemIcon
>
<
ListItemText
>
Sair
</
ListItemText
>
</
ListItem
>
</
Menu
>
</
div
>
)
}
...
...
cli/web/cliente/src/views/Main/connect.ts
View file @
4d5d769e
import
{
connect
}
from
'react-redux'
import
{
bindActionCreators
,
Dispatch
}
from
'redux'
import
{
Customer
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
session
from
'@agiliza/redux/session'
import
{
actions
as
drawerActions
}
from
'@agiliza/redux/ui/drawer'
import
{
isDrawerOpen
}
from
'@agiliza/redux/ui/drawer/selectors'
import
{
actions
as
loginActions
}
from
'@agiliza/redux/ui/login'
...
...
@@ -13,12 +15,14 @@ export interface ConnectedProps {
fetchMenu
:
typeof
systemActions
.
fetchMenu
toggleDrawer
:
typeof
drawerActions
.
toggleDrawer
logout
:
typeof
loginActions
.
logout
customer
?:
Customer
}
const
mapStateToProps
=
(
state
:
StoreState
)
=>
({
drawerOpen
:
isDrawerOpen
(
state
.
ui
.
drawer
),
fetchMenu
:
systemActions
.
fetchMenu
,
fetchingMenu
:
systemSelectors
.
isFetching
(
state
.
ui
.
system
),
customer
:
session
.
selectors
.
getCustomer
(
state
.
session
),
})
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
)
=>
...
...
cli/web/cliente/src/views/Projects/pages/ListProjects/ListProjects.tsx
View file @
4d5d769e
import
React
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
{
RouteComponentProps
}
from
'react-router'
import
{
Project
}
from
'@agiliza/api/domain/project'
import
{
Avatar
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
}
from
'@material-ui/core'
import
{
PATHS
}
from
'@agiliza/views/Main/DrawerItems'
import
{
Avatar
,
CircularProgress
,
List
,
ListItem
,
ListItemAvatar
,
ListItemText
,
ListSubheader
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
Apps
as
AppsIcon
}
from
'@material-ui/icons'
...
...
@@ -14,13 +23,29 @@ type ExtendedProps = WithStyles<typeof styles> & ConnectedProps & RouteComponent
interface
Props
extends
ExtendedProps
{}
const
ListProjects
=
(
props
:
Props
)
=>
{
const
{
classes
,
proposals
}
=
props
const
{
classes
,
fetching
,
proposals
,
history
}
=
props
const
handleClickListItem
=
(
proposal
:
Project
)
=>
()
=>
{}
useEffect
(()
=>
{
props
.
getProjects
()
},
[])
const
handleClickListItem
=
(
proposal
:
Project
)
=>
()
=>
{
props
.
setProposalId
(
proposal
.
id
)
history
.
push
({
pathname
:
PATHS
.
proposalData
,
state
:
{
proposalId
:
proposal
.
id
}
})
}
if
(
fetching
)
return
<
CircularProgress
/>
return
(
<
div
className=
{
classes
.
pageContent
}
>
<
List
className=
{
classes
.
list
}
>
<
List
className=
{
classes
.
list
}
subheader=
{
<
ListSubheader
component=
"div"
id=
"nested-list-subheader"
>
Projetos
</
ListSubheader
>
}
>
{
proposals
.
map
((
proposal
,
i
)
=>
(
<
ListItem
key=
{
i
}
button
onClick=
{
handleClickListItem
(
proposal
)
}
>
<
ListItemAvatar
>
...
...
cli/web/cliente/src/views/Projects/pages/ListProjects/connect.ts
View file @
4d5d769e
import
{
connect
}
from
'react-redux'
import
{
bindActionCreators
,
Dispatch
}
from
'redux'
import
{
Project
}
from
'@agiliza/api/domain/project'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entProject
from
'@agiliza/redux/entities/project'
import
*
as
uiSimulation
from
'@agiliza/redux/ui/simulation'
import
*
as
ucProject
from
'@agiliza/redux/useCases/project'
export
interface
ConnectedProps
{
fetching
:
boolean
proposals
:
Project
[]
getProjects
:
typeof
ucProject
.
actions
.
getProjects
setProposalId
:
typeof
uiSimulation
.
actions
.
setProposalId
setPersonId
:
typeof
uiSimulation
.
actions
.
setPersonId
}
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'proposals'
>
// type DispatchProps = Pick<ConnectedProps, 'getContext
'>
type
DispatchProps
=
Pick
<
ConnectedProps
,
'getProjects'
|
'setProposalId'
|
'setPersonId
'
>
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
false
,
proposals
:
[]
,
fetching
:
ucProject
.
selectors
.
isFetching
(
state
.
useCases
.
project
)
,
proposals
:
entProject
.
selectors
.
getProjects
(
state
.
entities
.
project
)
,
})
// const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
// bindActionCreators(
// {
// },
// dispatch
// )
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
):
DispatchProps
=>
bindActionCreators
(
{
getProjects
:
ucProject
.
actions
.
getProjects
,
setProposalId
:
uiSimulation
.
actions
.
setProposalId
,
setPersonId
:
uiSimulation
.
actions
.
setPersonId
,
},
dispatch
)
export
const
connected
=
connect
(
mapStateToProps
)
export
const
connected
=
connect
(
mapStateToProps
,
mapDispatchToProps
)
cli/web/cliente/src/views/Projects/pages/router.tsx
0 → 100644
View file @
4d5d769e
import
React
,
{
lazy
,
Suspense
}
from
'react'
import
{
Route
,
RouteComponentProps
,
Switch
}
from
'react-router'
import
AuthRoute
from
'@agiliza/components/atoms/AuthRoute'
import
{
PATHS
}
from
'@agiliza/views/Main/DrawerItems'
import
{
CircularProgress
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
styles
from
'./shared-styles'
export
const
PROJECTS_PATHS
=
{
login
:
PATHS
.
proposals
+
'/login'
,
}
const
ListProjects
=
lazy
(()
=>
import
(
'./ListProjects'
))
const
Login
=
lazy
(()
=>
import
(
'@agiliza/views/Login'
))
type
ExtendedProps
=
WithStyles
<
typeof
styles
>
&
RouteComponentProps
interface
Props
extends
ExtendedProps
{}
const
ProposalDataRouter
=
(
props
:
Props
)
=>
{
const
{
classes
}
=
props
return
(
<
div
className=
{
classes
.
pageContent
}
>
<
Suspense
fallback=
{
<
CircularProgress
className=
{
classes
.
circularProgress
}
/>
}
>
<
Switch
>
<
Route
path=
{
PROJECTS_PATHS
.
login
}
render=
{
(
renderProps
)
=>
<
Login
{
...
renderProps
}
redirectTo=
{
PATHS
.
proposals
}
/>
}
/>
<
AuthRoute
path=
{
PATHS
.
proposals
}
redirectTo=
{
PROJECTS_PATHS
.
login
}
component=
{
ListProjects
}
/>
</
Switch
>
</
Suspense
>
</
div
>
)
}
export
default
withStyles
(
styles
)(
ProposalDataRouter
)
cli/web/cliente/src/views/ProposalData/pages/BusinessData/Identification/state.ts
View file @
4d5d769e
import
{
file
}
from
'@agiliza/__mocks__/files'
import
{
BDIdentification
}
from
'@agiliza/api/domain'
type
ExtendedState
=
BDIdentification
...
...
@@ -8,34 +7,35 @@ export interface BDIdentificationState extends ExtendedState {
}
export
const
initialState
:
BDIdentificationState
=
process
.
env
.
NODE_ENV
===
'development'
?
{
cnpj
:
'81.867.778/0001-02'
,
activitySector
:
'1'
,
cityRegistration
:
'123456'
,
codeCNAE
:
'123456'
,
companyName
:
'TEST'
,
document
:
{
extraInformations
:
'TEST'
,
id
:
'1'
,
url
:
file
,
type
:
{
id
:
'1'
,
description
:
''
}
},
fantasyName
:
'TEST'
,
local
:
'1'
,
settledOP
:
'1'
,
stateRegistration
:
'123456'
,
commercialRegistration
:
'123456'
,
mainActivity
:
'TEST'
,
openingDate
:
new
Date
(
'2010-10-10'
),
}
:
{
cnpj
:
''
,
activitySector
:
''
,
cityRegistration
:
''
,
codeCNAE
:
''
,
companyName
:
''
,
document
:
{
extraInformations
:
''
,
id
:
''
,
url
:
''
,
type
:
{
id
:
''
,
description
:
''
}
},
fantasyName
:
''
,
local
:
''
,
settledOP
:
''
,
stateRegistration
:
''
,
commercialRegistration
:
''
,
mainActivity
:
''
,
openingDate
:
null
,
}
// process.env.NODE_ENV === 'development'
// ? {
// cnpj: '81.867.778/0001-02',
// activitySector: '1',
// cityRegistration: '123456',
// codeCNAE: '123456',
// companyName: 'TEST',
// document: { extraInformations: 'TEST', id: '1', url: file, type: { id: '1', description: '' } },
// fantasyName: 'TEST',
// local: '1',
// settledOP: '1',
// stateRegistration: '123456',
// commercialRegistration: '123456',
// mainActivity: 'TEST',
// openingDate: new Date('2010-10-10'),
// }
// :
{
cnpj
:
''
,
activitySector
:
''
,
cityRegistration
:
''
,
codeCNAE
:
''
,
companyName
:
''
,
document
:
{
extraInformations
:
''
,
id
:
''
,
url
:
''
,
type
:
{
id
:
''
,
description
:
''
}
},
fantasyName
:
''
,
local
:
''
,
settledOP
:
''
,
stateRegistration
:
''
,
commercialRegistration
:
''
,
mainActivity
:
''
,
openingDate
:
null
,
}
cli/web/cliente/src/views/ProposalData/pages/BusinessData/ProductsServices/connect.ts
View file @
4d5d769e
...
...
@@ -3,8 +3,8 @@ import { bindActionCreators, Dispatch } from 'redux'
import
{
BDProductService
,
ProposalDataContext
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entBusinessData
from
'@agiliza/redux/entities/proposalData/businessData'
import
*
as
entProposalDataContext
from
'@agiliza/redux/entities/proposalData/context'
import
*
as
entProposalData
from
'@agiliza/redux/entities/proposalData/proposal'
import
*
as
ucProposalData
from
'@agiliza/redux/useCases/proposalData/businessData'
export
interface
ConnectedProps
{
...
...
@@ -22,7 +22,7 @@ type DispatchProps = Pick<ConnectedProps, 'getProductsServices' | 'addProductSer
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalData
.
selectors
.
isFetching
(
state
.
useCases
.
proposalData
.
businessData
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
productsServices
:
ent
ProposalData
.
selectors
.
getProductsServices
(
state
.
entities
.
proposalData
.
proposal
),
productsServices
:
ent
BusinessData
.
selectors
.
getProductsServices
(
state
.
entities
.
proposalData
.
businessData
),
})
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
):
DispatchProps
=>
...
...
cli/web/cliente/src/views/ProposalData/pages/BusinessData/StockSalesCosts/connect.ts
View file @
4d5d769e
...
...
@@ -2,8 +2,8 @@ import { connect } from 'react-redux'
import
{
BDProductService
,
ProposalDataContext
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entBusinessData
from
'@agiliza/redux/entities/proposalData/businessData'
import
*
as
entProposalDataContext
from
'@agiliza/redux/entities/proposalData/context'
import
*
as
entProposalData
from
'@agiliza/redux/entities/proposalData/proposal'
export
interface
ConnectedProps
{
context
:
ProposalDataContext
...
...
@@ -15,7 +15,7 @@ type StateProps = Pick<ConnectedProps, 'context' | 'productsServices'>
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
productsServices
:
ent
ProposalData
.
selectors
.
getProductsServices
(
state
.
entities
.
proposalData
.
proposal
),
productsServices
:
ent
BusinessData
.
selectors
.
getProductsServices
(
state
.
entities
.
proposalData
.
businessData
),
})
// const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
...
...
cli/web/cliente/src/views/ProposalData/pages/BusinessData/StockSalesCosts/state.ts
View file @
4d5d769e
import
{
StockSalesCosts
}
from
'@agiliza/api/domain'
import
{
BD
StockSalesCosts
}
from
'@agiliza/api/domain'
type
ExtendedState
=
StockSalesCosts
type
ExtendedState
=
BD
StockSalesCosts
export
interface
BDStockSalesCostsState
extends
ExtendedState
{
totalStock
:
string
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/References/connect.ts
View file @
4d5d769e
...
...
@@ -4,7 +4,7 @@ import { bindActionCreators, Dispatch } from 'redux'
import
{
ProposalDataContext
,
Reference
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entProposalDataContext
from
'@agiliza/redux/entities/proposalData/context'
import
*
as
ent
ProposalData
from
'@agiliza/redux/entities/proposalData/proposal
'
import
*
as
ent
CustomerData
from
'@agiliza/redux/entities/proposalData/customerData
'
import
*
as
ucProposalData
from
'@agiliza/redux/useCases/proposalData/customerData'
export
interface
ConnectedProps
{
...
...
@@ -22,7 +22,7 @@ type DispatchProps = Pick<ConnectedProps, 'getReferences' | 'addReference' | 'up
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalData
.
selectors
.
isFetching
(
state
.
useCases
.
proposalData
.
customerData
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
references
:
ent
ProposalData
.
selectors
.
getReferences
(
state
.
entities
.
proposalData
.
proposal
),
references
:
ent
CustomerData
.
selectors
.
getReferences
(
state
.
entities
.
proposalData
.
customerData
),
})
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
):
DispatchProps
=>
...
...
cli/web/cliente/src/views/ProposalData/pages/CustomerData/Vehicles/conect.ts
View file @
4d5d769e
...
...
@@ -4,7 +4,7 @@ import { bindActionCreators, Dispatch } from 'redux'
import
{
ProposalDataContext
,
Vehicle
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entProposalDataContext
from
'@agiliza/redux/entities/proposalData/context'
import
*
as
ent
ProposalData
from
'@agiliza/redux/entities/proposalData/proposal
'
import
*
as
ent
CustomerData
from
'@agiliza/redux/entities/proposalData/customerData
'
import
*
as
ucProposalData
from
'@agiliza/redux/useCases/proposalData/customerData'
export
interface
ConnectedProps
{
...
...
@@ -22,7 +22,7 @@ type DispatchProps = Pick<ConnectedProps, 'getVehicles' | 'addVehicle' | 'update
const
mapStateToProps
=
(
state
:
StoreState
):
StateProps
=>
({
fetching
:
ucProposalData
.
selectors
.
isFetching
(
state
.
useCases
.
proposalData
.
customerData
),
context
:
entProposalDataContext
.
selectors
.
getContext
(
state
.
entities
.
proposalData
.
context
),
vehicles
:
ent
ProposalData
.
selectors
.
getVehicles
(
state
.
entities
.
proposalData
.
proposal
),
vehicles
:
ent
CustomerData
.
selectors
.
getVehicles
(
state
.
entities
.
proposalData
.
customerData
),
})
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
):
DispatchProps
=>
...
...
cli/web/cliente/src/views/ProposalData/pages/ProposalData.tsx
View file @
4d5d769e
...
...
@@ -3,8 +3,9 @@ import { RouteComponentProps } from 'react-router'
import
ButtonWithProgress
from
'@agiliza/components/atoms/ButtonWithProgress'
import
{
useFormState
}
from
'@agiliza/utils/hooks/state'
import
{
entries
}
from
'@agiliza/utils/method'
import
{
CREDIT_LINES_PATHS
}
from
'@agiliza/views/SimulationCreditLines/pages/router'
import
{
Button
,
MobileStepper
,
Typography
}
from
'@material-ui/core'
import
{
Button
,
CircularProgress
,
MobileStepper
,
Typography
}
from
'@material-ui/core'
import
{
withStyles
,
WithStyles
}
from
'@material-ui/core/styles'
import
{
AccountBox
as
AccountBoxIcon
,
...
...
@@ -52,7 +53,7 @@ export const PROPOSAL_DATA_PATHS = {
}
export
interface
ProposalDataRouteState
{
subproduct
Id
:
string
proposal
Id
:
string
}
type
ExtendedProps
=
WithStyles
<
typeof
styles
>
&
RouteComponentProps
&
ConnectedProps
...
...
@@ -60,7 +61,7 @@ type ExtendedProps = WithStyles<typeof styles> & RouteComponentProps & Connected
interface
Props
extends
ExtendedProps
{}
const
ProposalData
=
(
props
:
Props
)
=>
{
const
{
classes
,
history
,
fetching
,
proposalId
,
personId
}
=
props
const
{
classes
,
history
,
fetching
,
proposalId
,
personId
,
customerData
,
businessData
}
=
props
const
[
activeStep
,
setActiveStep
]
=
useState
(
0
)
useEffect
(()
=>
{
...
...
@@ -82,6 +83,87 @@ const ProposalData = (props: Props) => {
const
bdStockSalesCostsState
=
useFormState
(
'bdStockSalesCostsState'
,
bdStockSalesCostsInitState
)
const
bdProductServiceState
=
useFormState
(
'bdProductServiceState'
,
bdProductServiceInitState
)
useEffect
(()
=>
{
props
.
getBusinessData
({
projectId
:
proposalId
})
props
.
getCDIdentification
({
projectId
:
proposalId
,
onSuccess
:
(
pID
)
=>
{
if
(
pID
)
props
.
getCustomerData
({
projectId
:
proposalId
,
personId
:
pID
})
},
})
},
[])
useEffect
(()
=>
{
const
{
identification
,
personalData
,
address
,
sourceIncome
,
spousePersonalData
,
home
}
=
customerData
if
(
identification
)
cdIdentification
.
actions
.
update
(
entries
(
identification
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
personalData
)
cdPersonalData
.
actions
.
update
(
entries
(
personalData
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
address
)
cdAddress
.
actions
.
update
(
entries
(
address
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
sourceIncome
)
cdSourceIncome
.
actions
.
update
(
entries
(
sourceIncome
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
spousePersonalData
)
cdSpouseData
.
actions
.
update
(
entries
(
spousePersonalData
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
home
)
cdHomeState
.
actions
.
update
(
entries
(
home
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
},
[
customerData
])
useEffect
(()
=>
{
const
{
identification
,
address
,
stockSalesCosts
}
=
businessData
if
(
identification
)
bdIdentificationState
.
actions
.
update
(
entries
(
identification
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
address
)
bdAddressState
.
actions
.
update
(
entries
(
address
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
if
(
stockSalesCosts
)
bdStockSalesCostsState
.
actions
.
update
(
entries
(
stockSalesCosts
).
reduce
((
idn
,
[
k
,
v
])
=>
{
if
(
v
!==
undefined
)
return
{
...
idn
,
[
k
]:
v
}
else
return
idn
},
{})
)
},
[
businessData
])
const
customerDataItems
=
useMemo
(
()
=>
[
{
...
...
@@ -145,11 +227,18 @@ const ProposalData = (props: Props) => {
const
projectPersonIds
=
{
projectId
:
proposalId
,
personId
}
switch
(
activeStep
)
{
case
0
:
props
.
addIndentification
({
identification
:
{
...
cdIdentification
.
state
,
account
:
cdIdentification
.
state
.
hasAccount
?
cdIdentification
.
state
.
account
:
undefined
},
projectId
:
proposalId
,
onSuccess
:
()
=>
setActiveStep
((
prevActiveStep
)
=>
prevActiveStep
+
1
),
})
if
(
personId
)
props
.
updateCDIndentification
({
identification
:
{
...
cdIdentification
.
state
,
account
:
cdIdentification
.
state
.
hasAccount
?
cdIdentification
.
state
.
account
:
undefined
},
...
projectPersonIds
,
onSuccess
:
()
=>
setActiveStep
((
prevActiveStep
)
=>
prevActiveStep
+
1
),
})
else
props
.
addIndentification
({
identification
:
{
...
cdIdentification
.
state
,
account
:
cdIdentification
.
state
.
hasAccount
?
cdIdentification
.
state
.
account
:
undefined
},
projectId
:
proposalId
,
onSuccess
:
()
=>
setActiveStep
((
prevActiveStep
)
=>
prevActiveStep
+
1
),
})
break
case
1
:
props
.
updatePersonalData
({
...
...
@@ -194,7 +283,7 @@ const ProposalData = (props: Props) => {
})
break
case
9
:
props
.
updateIdentification
({
props
.
update
BD
Identification
({
projectId
:
proposalId
,
identification
:
bdIdentificationState
.
state
,
onSuccess
:
()
=>
setActiveStep
((
prevActiveStep
)
=>
prevActiveStep
+
1
),
...
...
@@ -241,7 +330,9 @@ const ProposalData = (props: Props) => {
{
mapActiveStepToTitle
()
}
</
Typography
>
<
Typography
className=
{
classes
.
pageSubtitle
}
>
{
proposalDataItems
[
activeStep
].
label
}
</
Typography
>
<
div
className=
{
classes
.
stepContentContainer
}
>
{
proposalDataItems
[
activeStep
].
component
}
</
div
>
<
div
className=
{
classes
.
stepContentContainer
}
>
{
fetching
?
<
CircularProgress
className=
{
classes
.
circularProgress
}
/>
:
proposalDataItems
[
activeStep
].
component
}
</
div
>
<
div
className=
{
classes
.
stepperContainer
}
>
{
/* <Stepper activeStep={activeStep} alternativeLabel className={classes.stepper}> */
}
{
/* {propostalDataItems.map((iPI, i) => (
...
...
cli/web/cliente/src/views/ProposalData/pages/connect.ts
View file @
4d5d769e
import
{
connect
}
from
'react-redux'
import
{
bindActionCreators
,
Dispatch
}
from
'redux'
import
{
BusinessData
,
InvolvedPerson
}
from
'@agiliza/api/domain'
import
{
StoreState
}
from
'@agiliza/redux'
import
*
as
entBusinessData
from
'@agiliza/redux/entities/proposalData/businessData'
import
*
as
entCustomerData
from
'@agiliza/redux/entities/proposalData/customerData'
import
*
as
entProposal
from
'@agiliza/redux/entities/proposalData/proposal'
import
*
as
ucAuthentication
from
'@agiliza/redux/useCases/authentication'
import
*
as
ucProposalDataBD
from
'@agiliza/redux/useCases/proposalData/businessData'
...
...
@@ -15,25 +18,32 @@ export interface ConnectedProps {
proposalId
:
string
personId
:
string
reset
:
()
=>
void
customerData
:
Omit
<
InvolvedPerson
,
'id'
>
businessData
:
BusinessData
fetchContext
:
typeof
ucProposalDataContext
.
actions
.
fetchContext
getContextAddress
:
typeof
ucAuthentication
.
actions
.
getContext
addIndentification
:
typeof
ucProposalDataCD
.
actions
.
addIndentification
updateCDIndentification
:
typeof
ucProposalDataCD
.
actions
.
updateIdentification
updatePersonalData
:
typeof
ucProposalDataCD
.
actions
.
updatePersonalData
updateCDAddress
:
typeof
ucProposalDataCD
.
actions
.
updateAddress
updateSourceIncome
:
typeof
ucProposalDataCD
.
actions
.
updateSourceIncome
updateSpouseData
:
typeof
ucProposalDataCD
.
actions
.
updateSpouseData
updateHome
:
typeof
ucProposalDataCD
.
actions
.
updateHome
updateIdentification
:
typeof
ucProposalDataBD
.
actions
.
updateIdentification
update
BD
Identification
:
typeof
ucProposalDataBD
.
actions
.
updateIdentification
updateBDAddress
:
typeof
ucProposalDataBD
.
actions
.
updateAddress
updateStockSalesCosts
:
typeof
ucProposalDataBD
.
actions
.
updateStockSalesCosts
sendProposal
:
typeof
ucSimulation
.
actions
.
sendProposal
getCDIdentification
:
typeof
ucProposalDataCD
.
actions
.
getIdentification
getCustomerData
:
typeof
ucProposalDataCD
.
actions
.
getCustomerData
getBusinessData
:
typeof
ucProposalDataBD
.
actions
.
getBusinessData
}
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'proposalId'
|
'personId'
>
type
StateProps
=
Pick
<
ConnectedProps
,
'fetching'
|
'proposalId'
|
'personId'
|
'businessData'
|
'customerData'
>
type
DispatchProps
=
Pick
<
ConnectedProps
,
|
'reset'
|
'addIndentification'
|
'updateCDIndentification'
|
'fetchContext'
|
'updatePersonalData'
|
'updateCDAddress'
...
...
@@ -41,17 +51,22 @@ type DispatchProps = Pick<
|
'updateSourceIncome'
|
'updateSpouseData'
|
'updateHome'
|
'updateIdentification'
|
'update
BD
Identification'
|
'updateBDAddress'
|
'updateStockSalesCosts'
|
'sendProposal'
|
'getCDIdentification'
|
'getCustomerData'
|
'getBusinessData'
>
const
isFetching
=
createSelector
(
(
state
:
StoreState
)
=>
ucProposalDataContext
.
selectors
.
isFetching
(
state
.
ui
.
login
),
(
state
:
StoreState
)
=>
ucAuthentication
.
selectors
.
isFetching
(
state
.
useCases
.
authentication
),
(
state
:
StoreState
)
=>
ucProposalDataCD
.
selectors
.
isFetching
(
state
.
useCases
.
proposalData
.
customerData
),
(
state
:
StoreState
)
=>
ucProposalDataCD
.
selectors
.
isGettingCustomerData
(
state
.
useCases
.
proposalData
.
customerData
),
(
state
:
StoreState
)
=>
ucProposalDataBD
.
selectors
.
isFetching
(
state
.
useCases
.
proposalData
.
businessData
),
(
state
:
StoreState
)
=>
ucProposalDataBD
.
selectors
.
isGettingBusinessData
(
state
.
useCases
.
proposalData
.
businessData
),
(
state
:
StoreState
)
=>
ucSimulation
.
selectors
.
isSendingProposal
(
state
.
useCases
.
simulation
),
(...
conditions
)
=>
conditions
.
some
((
c
)
=>
c
)
)
...
...
@@ -60,6 +75,8 @@ const mapStateToProps = (state: StoreState): StateProps => ({
fetching
:
isFetching
(
state
),
proposalId
:
entProposal
.
selectors
.
getProposalId
(
state
.
entities
.
proposalData
.
proposal
),
personId
:
entProposal
.
selectors
.
getPersonlId
(
state
.
entities
.
proposalData
.
proposal
),
customerData
:
entCustomerData
.
selectors
.
getCustomerData
(
state
.
entities
.
proposalData
.
customerData
),
businessData
:
entBusinessData
.
selectors
.
getBusinessData
(
state
.
entities
.
proposalData
.
businessData
),
})
const
mapDispatchToProps
=
(
dispatch
:
Dispatch
):
DispatchProps
=>
...
...
@@ -67,6 +84,7 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
{
reset
:
()
=>
({
type
:
'RESET_STORE'
}),
addIndentification
:
ucProposalDataCD
.
actions
.
addIndentification
,
updateCDIndentification
:
ucProposalDataCD
.
actions
.
updateIdentification
,
fetchContext
:
ucProposalDataContext
.
actions
.
fetchContext
,
updatePersonalData
:
ucProposalDataCD
.
actions
.
updatePersonalData
,
updateCDAddress
:
ucProposalDataCD
.
actions
.
updateAddress
,
...
...
@@ -75,9 +93,12 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps =>
updateSpouseData
:
ucProposalDataCD
.
actions
.
updateSpouseData
,
updateHome
:
ucProposalDataCD
.
actions
.
updateHome
,
updateBDAddress
:
ucProposalDataBD
.
actions
.
updateAddress
,
updateIdentification
:
ucProposalDataBD
.
actions
.
updateIdentification
,
update
BD
Identification
:
ucProposalDataBD
.
actions
.
updateIdentification
,
updateStockSalesCosts
:
ucProposalDataBD
.
actions
.
updateStockSalesCosts
,
sendProposal
:
ucSimulation
.
actions
.
sendProposal
,
getBusinessData
:
ucProposalDataBD
.
actions
.
getBusinessData
,
getCustomerData
:
ucProposalDataCD
.
actions
.
getCustomerData
,
getCDIdentification
:
ucProposalDataCD
.
actions
.
getIdentification
,
},
dispatch
)
...
...
cli/web/cliente/src/views/SimulationCreditLines/pages/Simulation/CreditLinesInfo/CreditLinesInfo.tsx
View file @
4d5d769e
import
{
lightFormat
}
from
'date-fns'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
SubProduct
}
from
'@agiliza/api/domain'
import
{
AMORTIZATIONS
}
from
'@agiliza/constants/amortization'
import
{
formatCurrency
}
from
'@agiliza/utils/formatters'
import
{
SelectField
}
from
'@curio/components'
import
{
Button
,
Grid
}
from
'@material-ui/core'
...
...
@@ -48,8 +50,16 @@ const CreditLinesInfo = (props: Props) => {
{
/* <GridLine label="Valor das parcelas" value={formatCurrency(subproduct?.amount.toFixed(2))} /> */
}
<
GridLine
label=
"Taxa de juros"
value=
{
subproduct
?.
fee
?
`${subproduct?.fee} %`
:
''
}
/>
<
GridLine
label=
"Valor total IOF"
value=
{
formatCurrency
(
subproduct
?.
IOF
?.
toString
()
||
''
)
}
/>
<
GridLine
label=
"Custo efetivo total (CET)"
value=
{
subproduct
?.
TAC
!==
undefined
?
`${subproduct?.TAC.toFixed(2)} %`
:
''
}
/>
{
/* <GridLine label="Taxa abertura crédito (TAC)" value={formatCurrency(subproduct?.TAC?.toFixed(2))} /> */
}
<
GridLine
label=
"Custo efetivo total mensal (CET)"
value=
{
`${subproduct?.monthlyCET?.toFixed(2) || ''} %`
}
/>
<
GridLine
label=
"Custo efetivo total anual (CET)"
value=
{
`${subproduct?.yearlyCET?.toFixed(2) || ''} %`
}
/>
<
GridLine
label=
"Taxa abertura crédito (TAC)"
value=
{
formatCurrency
(
subproduct
?.
TAC
?.
toFixed
(
2
))
}
/>
<
GridLine
label=
"Valor total liberado líquido"
value=
{
formatCurrency
(
subproduct
?.
totalLiberateLiquidValue
?.
toFixed
(
2
))
}
/>
<
GridLine
label=
"Valor do empréstimo"
value=
{
formatCurrency
(
subproduct
?.
feeTotalValue
?.
toFixed
(
2
))
}
/>
<
GridLine
label=
"Sistema de amortização"
value=
{
subproduct
?.
amortization
?
AMORTIZATIONS
[
subproduct
.
amortization
]
:
''
}
/>
<
GridLine
label=
"Quatidade de parcelas da carência"
value=
{
subproduct
?.
graceInstallementAmount
?.
toString
()
||
''
}
/>
<
GridLine
label=
"Valor total calculado"
value=
{
formatCurrency
(
subproduct
?.
totalCalcValue
?.
toFixed
(
2
)
||
''
)
}
/>
<
GridLine
label=
"Valor total juros"
value=
{
formatCurrency
(
subproduct
?.
feeTotalValue
?.
toFixed
(
2
)
||
''
)
}
/>
<
GridLine
label=
"Data base de cálculo"
value=
{
subproduct
?.
baseCalcDate
?
lightFormat
(
subproduct
.
baseCalcDate
,
'dd/MM/yyyy'
)
:
''
}
/>
</
Grid
>
<
Button
variant=
"text"
onClick=
{
()
=>
setOpen
(
true
)
}
disabled=
{
!
subproduct
}
>
Exibir opções de parcelamento
...
...
cli/web/cliente/src/views/SimulationCreditLines/pages/Simulation/Simulation.tsx
View file @
4d5d769e
...
...
@@ -52,7 +52,7 @@ const Simulation = (props: Props) => {
gracePeriodId
:
graceMonths
,
installmentsNumber
:
paymentMonths
,
subproductId
:
subproduct
.
id
,
onSuccess
:
(
)
=>
history
.
push
({
pathname
:
PATHS
.
proposalData
,
state
:
{
subproductId
:
subproduct
?.
i
d
}
}),
onSuccess
:
(
proposalId
)
=>
history
.
push
({
pathname
:
PATHS
.
proposalData
,
state
:
{
proposalI
d
}
}),
})
}
}
else
setActiveStep
((
prevActiveStep
)
=>
prevActiveStep
+
1
)
...
...
cli/web/cliente/tsconfig.json
View file @
4d5d769e
...
...
@@ -28,6 +28,7 @@
"@agiliza/public"
:
[
"public"
],
"@agiliza/public/*"
:
[
"public/*"
]
},
"useUnknownInCatchVariables"
:
false
,
"removeComments"
:
true
,
"preserveConstEnums"
:
true
,
"sourceMap"
:
true
,
...
...
cli/web/cliente/webpack.config.js
View file @
4d5d769e
...
...
@@ -118,7 +118,7 @@ const makeCommonPlugins = (env) => [
}),
new
HtmlWebpackPlugin
({
template
:
path
.
join
(
__dirname
,
'public'
,
'index.ejs'
),
favicon
:
path
.
join
(
PUBLIC
,
'images'
,
'
favicon
.png'
),
favicon
:
path
.
join
(
PUBLIC
,
'images'
,
'
pdcase
.png'
),
title
:
'Agiliza - Cliente'
,
inject
:
false
,
}),
...
...
cli/web/cliente/yarn.lock
View file @
4d5d769e
This diff is collapsed.
Click to expand it.
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