Skip to content

Commit afccb81

Browse files
committed
Merge branch 'feature/opportunity-AccountabilityAndMonitoring' into dev/v7.7-alpha
2 parents 64bf13b + 14bfacf commit afccb81

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

src/modules/Opportunities/components/opportunity-create-reporting-phase/template.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
<entity-field :entity="collectionPhase" prop="name" label="<?= i::__("Defina um título") ?>" hideRequired></entity-field>
2222
</div>
2323
<div class="col-6">
24-
<entity-field :entity="collectionPhase" prop="registrationFrom" :min="minCollectionDate" label="<?= i::__("Data de início") ?>" hideRequired></entity-field>
24+
<entity-field :entity="collectionPhase" prop="registrationFrom" label="<?= i::__("Data de início") ?>" hideRequired></entity-field>
2525
</div>
2626
<div class="col-6">
27-
<entity-field :entity="collectionPhase" prop="registrationTo" :min="collectionPhase.evaluationFrom?._date" label="<?= i::__("Data final") ?>" hideRequired></entity-field>
27+
<entity-field :entity="collectionPhase" prop="registrationTo" label="<?= i::__("Data final") ?>" hideRequired></entity-field>
2828
</div>
2929
<div class="col-12">
3030
<entity-field :entity="collectionPhase" prop="isFinalReportingPhase" label="<?= i::__('É fase final de prestação de informações?') ?>"></entity-field>
@@ -35,10 +35,10 @@
3535
<entity-field :entity="evaluationPhase" prop="name" label="<?= i::__("Defina um título") ?>" hideRequired></entity-field>
3636
</div>
3737
<div class="col-6">
38-
<entity-field :entity="evaluationPhase" prop="evaluationFrom" :min="collectionPhase.evaluationFrom?._date" label="<?= i::__("Data de início") ?>" hideRequired></entity-field>
38+
<entity-field :entity="evaluationPhase" prop="evaluationFrom" label="<?= i::__("Data de início") ?>" hideRequired></entity-field>
3939
</div>
4040
<div class="col-6">
41-
<entity-field :entity="evaluationPhase" prop="evaluationTo" :min="evaluationPhase.evaluationFrom?._date" label="<?= i::__("Data final") ?>" hideRequired></entity-field>
41+
<entity-field :entity="evaluationPhase" prop="evaluationTo" label="<?= i::__("Data final") ?>" hideRequired></entity-field>
4242
</div>
4343
</div>
4444
</template>

src/modules/Opportunities/components/opportunity-phase-config-data-collection/template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<div class="grid-12 col-12 opportunity-data-collection__section">
2222
<?php $this->applyTemplateHook('opportunity-data-collection-config','begin')?>
2323
<entity-field v-if="!phase.isFirstPhase" :entity="phase" prop="name" :autosave="3000" classes="col-12 sm:col-12"></entity-field>
24-
<entity-field :entity="phase" prop="registrationFrom" :autosave="3000" :min="fromDateMin?._date" :max="fromDateMax?._date" classes="col-6 sm:col-12"></entity-field>
25-
<entity-field v-if="!firstPhase?.isContinuousFlow" :entity="phase" prop="registrationTo" :autosave="3000" :min="toDateMin?._date" :max="toDateMax?._date" classes="col-6 sm:col-12"></entity-field>
24+
<entity-field :entity="phase" prop="registrationFrom" :autosave="3000" classes="col-6 sm:col-12"></entity-field>
25+
<entity-field v-if="!firstPhase?.isContinuousFlow" :entity="phase" prop="registrationTo" :autosave="3000" classes="col-6 sm:col-12"></entity-field>
2626
<entity-field v-if="phase.isReportingPhase" :entity="phase" prop="includesWorkPlan" classes="col-12"></entity-field>
2727

2828
<?php $this->applyTemplateHook('opportunity-data-collection-config','end')?>

src/modules/Opportunities/components/opportunity-phase-publish-date-config/template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div v-if="(!phase.publishedRegistrations && !firstPhase?.isContinuousFlow)" class="grid-12 col-12 notPublished opportunity-phase-publish-date-config__content">
3131
<div class="opportunity-phase-publish-date-config__left" :class="{ 'col-6': phase.appealPhase, 'col-4': !phase.appealPhase }">
3232

33-
<entity-field v-if="!hideDatepicker" :entity="phase" prop="publishTimestamp" :autosave="3000" :min="minDate" :max="maxDate" classes="col-4 opportunity-phase-publish-date-config__date"></entity-field>
33+
<entity-field v-if="!hideDatepicker" :entity="phase" prop="publishTimestamp" :autosave="3000" classes="col-4 opportunity-phase-publish-date-config__date"></entity-field>
3434

3535
<div v-if="hideDatepicker && phase.publishTimestamp" class="col-4 msgpub-date">
3636
<h5 v-if="phase.autoPublish && hideCheckbox">

src/modules/Opportunities/components/opportunity-phases-config/template.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@
9999
<template v-else-if="index === phases.length - 1">
100100
<div class="add-phase grid-12">
101101
<div class="col-12" v-if="!finalReportingPhase">
102-
<opportunity-create-reporting-phase :opportunity="entity" @create="addReportingPhases"></opportunity-create-reporting-phase>
102+
<mc-alert v-if="!lastPhase?.publishTimestamp" type="warning">
103+
<p><small class="required"><?= i::__("A data e hora da 'Publicação final' precisa estar preenchida para adicionar novas fases de prestação de informações.") ?></small></p>
104+
</mc-alert>
105+
106+
<opportunity-create-reporting-phase v-if="lastPhase?.publishTimestamp" :opportunity="entity" @create="addReportingPhases"></opportunity-create-reporting-phase>
103107
</div>
104108
</div>
105109
</template>

src/modules/OpportunityPhases/Module.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,14 @@ function _init () {
270270
return;
271271
}
272272
if($this->isNew()) {
273-
$value = $first_phase->lastPhase->previousPhase;
273+
if($this->isReportingPhase) {
274+
$value = $first_phase->lastPhase;
275+
while($next_phase = $value->nextPhase) {
276+
$value = $next_phase;
277+
}
278+
} else {
279+
$value = $first_phase->lastPhase->previousPhase;
280+
}
274281
return;
275282
}
276283
if($this->isFirstPhase) {
@@ -356,7 +363,12 @@ function _init () {
356363
return;
357364
}
358365
if($this->isNew()) {
359-
$value = $first_phase->lastPhase;
366+
if($this->isReportingPhase) {
367+
$value = null;
368+
} else {
369+
$value = $first_phase->lastPhase;
370+
}
371+
360372
return;
361373
}
362374

@@ -383,7 +395,7 @@ function _init () {
383395

384396
if($result = $query->getOneOrNullResult()) {
385397
$value = $result;
386-
} else {
398+
} else if(!$this->isReportingPhase) {
387399
$value = $last_phase;
388400
}
389401

@@ -1379,8 +1391,16 @@ function _init () {
13791391
$previous_date_to_string = '';
13801392
} else {
13811393
$previous = $this->previousPhase->evaluationMethodConfiguration ?: $this->previousPhase;
1382-
$previous_date_from = $previous->evaluationFrom ?: $previous->registrationFrom;
1383-
$previous_date_to = $previous->evaluationTo ?: $previous->registrationTo;
1394+
1395+
// Caso da primeira fase de monitoramento
1396+
if($previous->isLastPhase) {
1397+
$previous_date_from = $previous->publishTimestamp;
1398+
$previous_date_to = $previous->publishTimestamp;
1399+
} else {
1400+
$previous_date_from = $previous->evaluationFrom ?: $previous->registrationFrom;
1401+
$previous_date_to = $previous->evaluationTo ?: $previous->registrationTo;
1402+
}
1403+
13841404
$previous_date_from_string = $previous_date_from ? $previous_date_from->format('Y-m-d H:i:s') : null;
13851405
$previous_date_to_string = $previous_date_to ? $previous_date_to->format('Y-m-d H:i:s') : null;
13861406

0 commit comments

Comments
 (0)