Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #209

Merged
merged 15 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ e este projeto adere ao [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Melhorias
- Implementa hook no método registerRegistrationMetadata da oportunidade, para possibilitar incremento de novos registros atrevéz de plugins e módulos
- Implementa novos hook's para possibilitar manipulação da tela de listagem de fases
- Implementa possibilidade de definir mascaras em inputs do entity-field
- Implementa contante global mcTabActive para guadar a aba que o mc-tab está selecionada
- Implementa getter lastPhase() para as inscrições, possibilitando recuperar a entidade da inscrição na ultima fase

### Correções
- Corrige erro no carregamento do formulário de avaliação para o avaliador
- Ajusta estêncil do upload de imagem para carregar ja no tamanho máximo permitido
- Corrige db-update que atualiza legado da distribuição de avaliaçações por categoria
- Corrige db-update que cria as colunas eligible e score
- Corrige remoção de abas do componente mc-tabs

### Melhorias não funcionais
- Refatora script start.sh e middleware ExecutionTime para fornecer um log mais limpo para o desenvolvedor

## [7.4] 2024-05-28
### Novas funcionalidades
Expand Down
2 changes: 1 addition & 1 deletion docker/development/start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

php -S 0.0.0.0:80 -t /var/www/html /var/www/dev/router.php
php -S 0.0.0.0:80 -q -t /var/www/html /var/www/dev/router.php
2 changes: 1 addition & 1 deletion src/core/Entities/Opportunity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ function registerRegistrationMetadata($also_previous_phases = false){
$app->registerMetadata($metadata, Registration::class);
}

$app->applyHookBoundTo($this, "{$this->hookPrefix}.registrationMetadada");
$app->applyHookBoundTo($this, "{$this->hookPrefix}.registrationMetadata");

if($also_previous_phases && $this->parent) {
$this->previousPhase->registerRegistrationMetadata();
Expand Down
12 changes: 6 additions & 6 deletions src/core/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1215,12 +1215,12 @@ public function postPersist($args = null){

$hook_prefix = $this->getHookPrefix();

// $app->applyHookBoundTo($this, "{$hook_prefix}.insert:after");
//
// if ($this->usesPermissionCache()) {
// $this->createPermissionsCacheForUsers([$this->ownerUser]);
// $app->enqueueEntityToPCacheRecreation($this);
// }
$app->applyHookBoundTo($this, "{$hook_prefix}.insert:after");

if ($this->usesPermissionCache()) {
$this->createPermissionsCacheForUsers([$this->ownerUser]);
$app->enqueueEntityToPCacheRecreation($this);
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/core/Middlewares/ExecutionTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public function __invoke(Request $request, RequestHandler $handler) {
$app = App::i();

$app->log->info('=========================================================================');

$app->log->debug($_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI']);

$response = $handler->handle($request);

$endTime = microtime(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ app.component("mc-image-uploader", {
},

loadImage(event, modal) {
modal.open();
// Reference to the DOM input element
const { files } = event.target;
const filename = event.target.value.split(/(\\|\/)/g).pop();

// Ensure that you have a file before attempting to read it
if (files && files[0]) {
modal.open();
const filename = event.target.value.split(/(\\|\/)/g).pop();

// Ensure that you have a file before attempting to read it
// 1. Revoke the object URL, to allow the garbage collector to destroy the uploaded before file
if (this.image.src) {
URL.revokeObjectURL(this.image.src);
Expand Down
11 changes: 11 additions & 0 deletions src/modules/Components/components/mc-tab/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ app.component('mc-tab', {
const hash = '#' + (!props.disabled ? props.slug : '')
const isActive = Vue.ref(false)
const tabsProvider = Vue.inject('tabsProvider')
const global = useGlobalState();

let timeout = null
Vue.watch(
() => tabsProvider.activeTab,
() => {
isActive.value = props.slug === tabsProvider.activeTab?.slug
global.mcTabActive = tabsProvider.activeTab?.slug;

window.clearTimeout(timeout)
if (props.cache) {
Expand Down Expand Up @@ -67,6 +69,15 @@ app.component('mc-tab', {
})
})

Vue.onBeforeUnmount(() => {
const tab = tabsProvider.tabs.find((tab) => tab.hash == hash);

const index = tabsProvider.tabs.indexOf(tab);
if (index > -1) {
tabsProvider.tabs.splice(index, 1);
}
});

return {
cached,
hash,
Expand Down
4 changes: 4 additions & 0 deletions src/modules/Entities/components/entity-field/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ app.component('entity-field', {
type: Boolean,
default: false
},
mask: {
type: String,
default: null,
},
},

computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<input v-if="is('cnpj')" v-maska data-maska="##.###.###/####-##" :value="value" :id="propId" :name="prop" type="text" @input="change($event)" @blur="change($event,true)" autocomplete="off">
<input v-if="is('brPhone')" v-maska data-maska="['(##) #####-####','(##) ####-####']" data-maska-tokens="0:[0-9]:optional" :value="value" :id="propId" :name="prop" type="text" @input="change($event)" @blur="change($event,true)" autocomplete="off">
<input v-if="is('cep')" v-maska data-maska="#####-###" :value="value" :id="propId" :name="prop" type="text" @input="change($event)" @blur="change($event,true)" autocomplete="off">
<input v-if="is('fieldMask')" v-maska :data-maska="mask" :value="value" :id="propId" :name="prop" type="text" @input="change($event)" @blur="change($event,true)" autocomplete="off">

<input v-if="is('string') || is('text')" :value="value" :id="propId" :name="prop" type="text" @input="change($event)" @blur="change($event,true)" autocomplete="off" :placeholder="placeholder || description?.placeholder">
<div v-if="is('textarea') && prop=='shortDescription'" class="field__shortdescription">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
');
?>
<section :class="['timeline', {'center': center}, {'big': big}]">
<?php $this->applyComponentHook('item', 'before'); ?>
<div v-for="item in phases" :class="['item', {'active': isActive(item)}, {'happened': itHappened(item)}]" :set="registration = getRegistration(item)">
<div class="item__dot"> <span class="dot"></span> </div>
<div class="item__content">
Expand Down Expand Up @@ -44,4 +45,5 @@
<?php $this->applyComponentHook('item', 'end'); ?>
</div>
</div>
<?php $this->applyComponentHook('item', 'after'); ?>
</section>
4 changes: 4 additions & 0 deletions src/modules/Opportunities/views/registration/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<opportunity-header :opportunity="entity.opportunity"></opportunity-header>
<registration-print :registration="entity"></registration-print>
<mc-tabs sync-hash>
<?php $this->applyTemplateHook('single-tab', 'begin') ?>

<mc-tab label="<?= i::_e('Acompanhamento') ?>" slug="acompanhamento">
<div class="registration__content">
<mc-card>
Expand Down Expand Up @@ -299,5 +301,7 @@
<?php endwhile ?>
</div>
</mc-tab>

<?php $this->applyTemplateHook('single-tab', 'end') ?>
</mc-tabs>
</div>
5 changes: 5 additions & 0 deletions src/modules/OpportunityPhases/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ function _init () {
return;
});

$app->hook('entity(Registration).get(lastPhase)', function(&$value) use ($app) {
/** @var Registration $this */
$value = $app->repo('Registration')->findOneBy(['number' => $this->number, 'opportunity' => $this->opportunity->lastPhase]);
});

/**
* Getters das fases de avaliação
*/
Expand Down
Loading