Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 65 additions & 55 deletions frontend/src/screens/ConfirmacaoFeirante/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ class ConfirmacaoFeirante extends PureComponent {
locations: customMap.locations.map((location, index) => {
const feirantes = confirmados.feirantes
? confirmados.feirantes.filter(
feirante => feirante.celulaId === index
)
feirante => feirante.celulaId === index
)
: [];
const newLocation = {
...location,
Expand Down Expand Up @@ -252,8 +252,8 @@ class ConfirmacaoFeirante extends PureComponent {
})}
</Row>
) : (
<p>Sem avisos para a próxima feira</p>
)}
<p>Sem avisos para a próxima feira</p>
)}
</div>
);
};
Expand All @@ -270,92 +270,102 @@ class ConfirmacaoFeirante extends PureComponent {
style={{
backgroundImage: `url(${
process.env.REACT_APP_HOST
}/image/${feiraEventoImagem})`
}/image/${feiraEventoImagem})`
}}
/>
);
};

_renderSteps = () => {
const {current = 0} = this.state;
const { current = 0 } = this.state;
return (
<>
<Steps current={current}>
<Step title="Confirmar Presença" />
<Step title="Aguardando confirmação" />
<Step title="Presença Confirmada" />
</Steps>
<Step title="Confirmar Presença" />
<Step title="Aguardando confirmação" />
<Step title="Presença Confirmada" />
</Steps>

{this._renderCurrentStep()}
{this._renderCurrentStep()}
</>
)

}

_renderAlert = () => {
const { history } = this.props;
return (
<ContentComponent>
<Alert
message="Aviso"
description={
<div>
<p>É necessário lançar o faturamento da última feira para prosseguir</p>
<Button
type="primary"
onClick={() => { history.push('../feirante/relatorio')}}
>Lançar</Button>
</div>
}
type="info"
showIcon
/>
</ContentComponent>
);
return (
<ContentComponent>
<Alert
message="Aviso"
deion={
<div>
<p>É necessário lançar o faturamento da última feira para prosseguir</p>
<Button
type="primary"
onClick={() => { history.push('../feirante/relatorio') }}
>Lançar</Button>
</div>
}
type="info"
showIcon
/>
</ContentComponent>
);

}

render() {
const { loading, feiraAtual, visible, participacao } = this.state;

if (loading) return null;
if (feiraAtual.data === undefined) {
return (
<ContentComponent>
<Alert
message="Aviso"
description="Não há feiras cadastradas para esta semana"
type="info"
showIcon
/>
</ContentComponent>
);
}

_renderContent = () => {
const { feiraAtual, visible, participacao } = this.state;
return (
<ContentComponent
loading={loading}
title={`Próxima feira: ${moment(feiraAtual.data).format("DD/MM/YYYY")}`}
limitedSize
>
<>
{this._renderFotoEventoFeira()}
{this._renderAvisos()}

{
!participacao.faturamento && !moment(feiraAtual.data, 'yyyy-mm-dd').isSame(moment(participacao.data_feira))
? this._renderAlert()
? this._renderAlert()
: this._renderSteps()
}

<Modal visible={visible} onCancel={this._hideModal} footer={null} width="80%">
<img
src={`${process.env.REACT_APP_HOST}/image/${
feiraAtual.evento_image_url
}`}
}`}
alt="evento"
className={styles.imagemEvento}
/>
</Modal>
</>
)
}

render() {
const { loading, feiraAtual } = this.state;

return (
<ContentComponent
loading={loading}
title={
feiraAtual.data
? `Próxima feira: ${moment(feiraAtual.data).format("DD/MM/YYYY")}`
: null
}
limitedSize
>
{
!loading && !feiraAtual.data
? (
<Alert
message="Aviso"
deion="Não há feiras cadastradas para esta semana"
type="info"
showIcon
/>
) : this._renderContent()

}
</ContentComponent>
);
}
Expand All @@ -365,4 +375,4 @@ const WrappedHorizontalConfirmacaoFeiranteForm = Form.create({
name: "feiras_form"
})(ConfirmacaoFeirante);

export default WrappedHorizontalConfirmacaoFeiranteForm;
export default WrappedHorizontalConfirmacaoFeiranteForm;