Skip to content
Open
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
37 changes: 29 additions & 8 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ class Plugin extends \MapasCulturais\Plugin {
public function _init () {
$app = App::i();

$app->hook('view.partial(singles/opportunity-evaluations--committee):after', function($template){
$data = [];
$app->hook('view.render(<<*>>):before', function () use ($app) {
$this->enqueueScript('app', 'editRegistration', 'js/editRegistration.js');
$this->part('singles/edit-registration-opportunity-evaluations', ['template' => $template]);
$this->enqueueScript('app', 'remodal', 'js/remodal.min.js');
$app->view->enqueueStyle('app', 'editRegistration', 'css/edtRegistrationStyle.css');
$this->enqueueStyle('app', 'remodal', 'css/remodal/remodal.min.css');
$this->enqueueStyle('app', 'remodal-theme', 'css/remodal/remodal-default-theme.min.css');
});

// $app->hook('view.partial(singles/opportunity-evaluations--committee):after', function($template){
// $data = [];

// });

$app->hook('view.partial(singles/registration-single--header):after', function($template, $app){

Expand All @@ -25,7 +32,8 @@ public function _init () {
$this->part('singles/edit-registration-single--header', ['entity' => $entity, 'opportunity' => $opportunity, 'id' => $id]);
});

$app->hook('POST(registration.alterStatusRegistration)', function () use ($app) {
$app->hook('POST(registration.alterStatusRegistration)', function () use ($app)
{
try {
//
$this->requireAuthentication();
Expand All @@ -42,19 +50,32 @@ public function _init () {
// ADICIONANDO MODAL DE CAMPOS OBRIGATÓRIOS
$app->hook('view.partial(singles/registration-edit--fields):after', function() use($app){
$this->part('modals/info-field--required');

});
//NA PÁGINA DA CRIAÇÃO DA OPORTUNIDADE
$app->hook('template(opportunity.edit.registration-config):after', function() use($app){
$this->enqueueScript('app', 'editRegistration', 'js/editRegistration.js');
$this->part('singles/edit-registration-opportunity-evaluations');
});

$app->hook(' template(registration.view.form):end', function() use($app){
$this->part('singles/edit-registration-message--send');
});

$app->hook('template(registration.view.pdf-report-btn):before', function() use($app){

$app->hook('template(registration.view.header-fieldset):before', function() use($app){
$day = new DateTime('now');
$cantEdit = false;

//A entidade é a inscrição
$entity = $this->data['entity'];
/** CASO A DATA DE HOJE FOR MENOR OU IGUAL A DATA DO FIM DA INSCRIÇÃO */
if($this->data['entity']->opportunity->select_edit_registration == '1' && ($day <= $this->data['entity']->opportunity->registrationTo)) {
if($this->data['entity']->opportunity->select_edit_registration == '1' &&
($day <= $this->data['entity']->opportunity->registrationTo)) {
$cantEdit = true;
}

if($cantEdit)
$this->part('singles/edit-registration-button-edition');
$this->part('singles/edit-registration-button-edition',['entity' => $entity]);
});

/**
Expand Down
7 changes: 6 additions & 1 deletion assets/css/edtRegistrationStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@
.btn-registration {
background-color: #20873B !important;
border: 1px solid #20873B !important;
margin-bottom: 5px;
}

.btn-registration:hover {
background-color: #20873B ;
background-color: #07a330 !important;
border: 1px solid #20873B !important;
margin: 5px;
}

.registration-header-check > a {
Expand Down Expand Up @@ -114,4 +116,7 @@
background: #8C9EFF;
flex-direction: row;
align-items: center;
}
.registration-help-edit-registration {
margin-left: 15px;
}
1 change: 1 addition & 0 deletions assets/css/remodal/remodal-default-theme.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/css/remodal/remodal.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 34 additions & 2 deletions assets/js/editRegistration.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,38 @@ $(document).ready(function () {
$(".agentes-relacionados .registration-fieldset > span").show();
}
}
$("#select_edit_registrations").editable('setValue', select);
$("#select_edit_registration").editable('setValue', select);
}
});
// var dataPostSendAudit = {
// "user_id": 25414,
// "object_id": "55544111",
// "object_type": "Registratrion",
// "action": "Criou",
// "message": "Criou um registro",
// "key": "field_4455",
// "value": "Adionando valores"
// }
// jQuery.ajax({
// url:'http://localhost:5000/audit',
// type: "OPTIONS",
// data: dataPostSendAudit,
// dataType: "text",
// contentType: "text/plain; charset=utf-8",
// success: function(res){
// console.log({res})
// },
// error: function(err){
// console.log({err})
// }

// })
// .done(function() {
// console.log( "second success" );
// })
// .fail(function() {
// console.log( "error" );
// })
// .always(function() {
// console.log( "finished" );
// });
});
10 changes: 10 additions & 0 deletions assets/js/remodal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion layouts/parts/singles/edit-registration-button-edition.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<?php
//Somente o admin pode alterar a inscrição
if($entity->canUser('@control')):
?>

<a href="#" class="btn btn-success btn-registration" data-remodal-target="modal-edit-registration" title="Edite a sua inscrição">
<?php \MapasCulturais\i::_e('Editar Inscrição') ?>
</a>
</a>

<?php

endif;

?>
15 changes: 15 additions & 0 deletions layouts/parts/singles/edit-registration-message--send.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script>
$(document).ready(function () {
//OCUTANDO TEXTO DO TEMA BASEV1
$(".registration-help").empty();
});
</script>

<div class="registration-fieldset alert info">
<p class="registration-help-edit-registration">
<?php \MapasCulturais\i::_e("Certifique-se que você preencheu as informações corretamente antes de enviar sua inscrição.");?>
<strong>
<?php \MapasCulturais\i::_e("Somente será possível editar a sua inscrição em algumas oportunidade.");?>
</strong>
</p>
</div>
Loading