-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #290 - Making teachers enrollment to process asynchronous and r…
…efactoring
- Loading branch information
1 parent
e86a313
commit e9389e2
Showing
11 changed files
with
514 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 43 additions & 28 deletions
71
application/modules/program/views/selection_process/define_teachers.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,50 @@ | ||
<h2 class="principal">Vincular docentes ao processo seletivo </h2> | ||
|
||
<?php buildTableDeclaration(); ?> | ||
<?php | ||
buildTableHeaders([ | ||
'Nome', | ||
'E-mail', | ||
'Programa', | ||
'Ações' | ||
]); | ||
?> | ||
<div id="define_teachers_tables" class="row"> | ||
<?php include('define_teachers_tables.php'); ?>; | ||
</div> | ||
|
||
<?php if(!empty($teachers)): ?> | ||
<?php foreach ($teachers as $teacher): ?> | ||
<style type="text/css"> | ||
#add_teachers_to_process_table, #teachers_added_to_process_table { | ||
height: 400px; | ||
overflow-y: auto; | ||
} | ||
</style> | ||
|
||
<tr> | ||
<td><?= $teacher['name'] ?></td> | ||
<td><?= $teacher['email'] ?></td> | ||
<td><?= $teacher['program_name'] ?></td> | ||
<td> | ||
<?= anchor( | ||
"selection_process/define_teacher/{$processId}/{$teacher['id']}/{$programId}", | ||
"<i class='fa fa-plus'></i> Vincular docente", | ||
"class='btn btn-primary'" | ||
) ?> | ||
</td> | ||
</tr> | ||
<script> | ||
function addTeacherToProcess(event, processId, teacherId, programId){ | ||
event.preventDefault(); | ||
|
||
<?php endforeach ?> | ||
<?php else: ?> | ||
<?= callout('info', 'Nenhum docente cadastrado nos cursos deste programa.') ?> | ||
<?php endif ?> | ||
var siteUrl = $("#site_url").val(); | ||
var urlToPost = siteUrl + "/selection_process/define_teacher" | ||
$.post( | ||
urlToPost, | ||
{ | ||
processId: processId, | ||
teacherId: teacherId, | ||
programId: programId | ||
}, | ||
function(data){ | ||
$("#define_teachers_tables").html(data); | ||
} | ||
); | ||
} | ||
|
||
<?php buildTableEndDeclaration(); ?> | ||
function removeTeacherFromProcess(event, processId, teacherId, programId){ | ||
event.preventDefault(); | ||
|
||
var siteUrl = $("#site_url").val(); | ||
var urlToPost = siteUrl + "/selection_process/remove_teacher" | ||
$.post( | ||
urlToPost, | ||
{ | ||
processId: processId, | ||
teacherId: teacherId, | ||
programId: programId | ||
}, | ||
function(data){ | ||
$("#define_teachers_tables").html(data); | ||
} | ||
); | ||
} | ||
</script> |
37 changes: 37 additions & 0 deletions
37
application/modules/program/views/selection_process/define_teachers_add_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?= "<h4><i class='fa fa-list'></i> Docentes do programa:</h4>" ?> | ||
|
||
<?php if(!empty($teachers)): ?> | ||
|
||
<?php buildTableDeclaration("add_teachers_to_process_table"); | ||
|
||
buildTableHeaders([ | ||
'Nome', | ||
'E-mail', | ||
'Ações' | ||
]); | ||
?> | ||
|
||
<?php foreach ($teachers as $teacher): ?> | ||
|
||
<tr> | ||
<td><?= $teacher['name'] ?></td> | ||
<td><?= $teacher['email'] ?></td> | ||
<td> | ||
<?php if(!$processTeachers || !in_array($teacher, $processTeachers)): ?> | ||
<?= anchor( | ||
"#", | ||
"<i class='fa fa-plus'></i> Vincular docente", | ||
"class='btn btn-primary' onClick='addTeacherToProcess(event, {$processId}, {$teacher['id']}, {$programId});'" | ||
) ?> | ||
<?php else: ?> | ||
<?= "<span class='label label-success'>Docente vinculado!</span>" ?> | ||
<?php endif; ?> | ||
</td> | ||
</tr> | ||
|
||
<?php endforeach ?> | ||
|
||
<?php buildTableEndDeclaration(); ?> | ||
<?php else: ?> | ||
<?= callout('info', 'Nenhum docente cadastrado nos cursos deste programa.') ?> | ||
<?php endif ?> |
34 changes: 34 additions & 0 deletions
34
application/modules/program/views/selection_process/define_teachers_remove_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?= "<h4><i class='fa fa-plus-square'></i> Docentes adicionados ao processo:</h4>" ?> | ||
|
||
|
||
<?php if(!empty($processTeachers)): ?> | ||
|
||
<?php buildTableDeclaration("teachers_added_to_process_table"); | ||
buildTableHeaders([ | ||
'Nome', | ||
'E-mail', | ||
'Ações' | ||
]); | ||
?> | ||
|
||
<?php foreach ($processTeachers as $teacher): ?> | ||
|
||
<tr> | ||
<td><?= $teacher['name'] ?></td> | ||
<td><?= $teacher['email'] ?></td> | ||
<td> | ||
<?= anchor( | ||
"#", | ||
"<i class='fa fa-minus'></i> Desvincular docente", | ||
"class='btn btn-danger' onClick='removeTeacherFromProcess(event, {$processId}, {$teacher['id']}, {$programId});'" | ||
) ?> | ||
</td> | ||
</tr> | ||
|
||
<?php endforeach ?> | ||
|
||
<?php buildTableEndDeclaration(); ?> | ||
|
||
<?php else: ?> | ||
<?= callout('info', 'Nenhum docente vinculado a este processo.') ?> | ||
<?php endif ?> |
14 changes: 14 additions & 0 deletions
14
application/modules/program/views/selection_process/define_teachers_tables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="col-md-6"> | ||
<?php | ||
call_user_func(function() use($teachers, $processTeachers, $processId, $programId){ | ||
include('define_teachers_add_table.php'); | ||
}); | ||
?> | ||
</div> | ||
<div class="col-md-6"> | ||
<?php | ||
call_user_func(function() use($processTeachers, $processId, $programId){ | ||
include('define_teachers_remove_table.php'); | ||
}); | ||
?> | ||
</div> |
Oops, something went wrong.