Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
submeta
Commits
653d68f8
Commit
653d68f8
authored
Jun 18, 2020
by
alinetenorio
Browse files
habilitando plano de trabalho e corrigindo update
parent
e725aacd
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
653d68f8
...
...
@@ -603,11 +603,14 @@ class TrabalhoController extends Controller
$participante
->
update
();
//atualizando planos de trabalho
if
(
array_key_exists
(
$key
,
$request
->
anexoPlanoTrabalho
))
{
if
(
$request
->
anexoPlanoTrabalho
!=
null
&&
array_key_exists
(
$key
,
$request
->
anexoPlanoTrabalho
))
{
if
(
!
(
is_null
(
$request
->
anexoPlanoTrabalho
[
$key
])))
{
$arquivo
=
Arquivo
::
where
(
'participanteId'
,
$participante
->
id
)
->
first
();
Storage
::
delete
(
$arquivo
->
nome
);
$arquivo
->
delete
();
//se plano já existir, deletar
if
(
$arquivo
!=
null
){
Storage
::
delete
(
$arquivo
->
nome
);
$arquivo
->
delete
();
}
$path
=
'trabalhos/'
.
$request
->
editalId
.
'/'
.
$trabalho
->
id
.
'/'
;
$nome
=
$request
->
nomePlanoTrabalho
[
$key
]
.
".pdf"
;
...
...
resources/views/projeto/editar.blade.php
View file @
653d68f8
...
...
@@ -318,7 +318,7 @@
</div>
</div>
<h6 class="
mb
-
1
">Possui plano de trabalho?</h6>
<button class="
btn
btn
-
primary
mt
-
2
mb
-
2
simPlano
">Sim</button>
<button class="
btn
btn
-
primary
mt
-
2
mb
-
2
simPlano
"
id="
simPlano
"
>Sim</button>
<button class="
btn
btn
-
primary
mt
-
2
mb
-
2
naoPlano
">Não</button>
<div id="
planoHabilitado
" >
@foreach (
$arquivos
as
$arquivo
)
...
...
@@ -413,20 +413,30 @@
}
});
$
(
'
#addPlanoTrabalh
o'
)
.
click
(
function
(
e
)
{
e
.
preventDefault
()
;
if
(
qtdLinhas
<
4
)
{
linha
=
montarLinhaInputPlanoTrabalho
();
$
(
'#planoTrabalho'
)
.
append
(
linha
);
qtdLinhas
++
;
$
(
'
.simPlan
o'
)
.
click
(
function
(
e
)
{
var
possuiPlano
=
$
(
this
)
.
next
()
.
next
()[
0
]
.
firstElementChild
;
if
(
possuiPlano
==
null
)
{
e
.
preventDefault
();
linha
=
linhaPlanoTrabalho
();
$
(
this
)
.
next
()
.
next
()
.
append
(
linha
);
}
});
// $('#addPlanoTrabalho').click(function(e) {
// e.preventDefault();
// if (qtdLinhas < 4) {
// linha = montarLinhaInputPlanoTrabalho();
// $('#planoTrabalho').append(linha);
// qtdLinhas++;
// }
// });
// Exibir modalidade de acordo com a área
// $("#area").change(function() {
// console.log($(this).val());
// addModalidade($(this).val());
// });
$
(
document
)
.
on
(
'click'
,
'.delete'
,
function
()
{
if
(
qtdParticipantes
>
1
)
{
qtdParticipantes
--
;
...
...
@@ -461,9 +471,9 @@
});
$
(
document
)
.
on
(
'click'
,
'.simPlano'
,
function
(
e
)
{
e
.
preventDefault
();
var
plano
=
$
(
this
)
.
next
()
.
next
()[
0
];
plano
.
style
.
display
=
'block'
;
$
(
this
)
.
next
()[
0
]
.
className
=
'btn btn-primary mt-2 mb-2 naoPlano'
;
//
var plano = $(this).next().next()[0];
//
plano.style.display = 'block';
$
(
this
)
.
next
()[
0
]
.
className
=
'btn btn-primary mt-2 mb-2 naoPlano'
;
console
.
log
(
'button sim'
);
});
$
(
document
)
.
on
(
'click'
,
'.naoPlano'
,
function
(
e
)
{
...
...
@@ -611,6 +621,46 @@
// "</div>";
// }
function
linhaPlanoTrabalho
(){
return
"<h5>Dados do plano de trabalho</h5>"
+
"<div class="
+
"row"
+
">"
+
"<div class="
+
"col-sm-4"
+
">"
+
"<label>Titulo*</label>"
+
"<input"
+
" type="
+
'text'
+
" style="
+
"margin-bottom:10px"
+
" class="
+
"form-control @error('nomePlanoTrabalho') is-invalid @enderror"
+
" name="
+
'nomePlanoTrabalho[]'
+
" placeholder="
+
"Nome"
+
">"
+
"@error('nomePlanoTrabalho')"
+
"<span class='invalid-feedback'"
+
"role='alert'"
+
"style='overflow: visible; display:block'>"
+
"<strong>{{
$message
}}</strong>"
+
"</span>"
+
"@enderror"
+
"</div>"
+
"<div class="
+
"col-sm-7"
+
">"
+
"<label for="
+
"nomeTrabalho"
+
">Anexo* </label>"
+
"<div class="
+
"input-group"
+
">"
+
"<div class='input-group-prepend'>"
+
"<span class='input-group-text' id='inputGroupFileAddon01'>Selecione um arquivo:</span>"
+
"</div>"
+
"<div class='custom-file'>"
+
"<input type='file' class='custom-file-input @error('anexoPlanoTrabalho') is-invalid @enderror"
+
"id='inputGroupFile01'"
+
"aria-describedby='inputGroupFileAddon01' name='anexoPlanoTrabalho[]'>"
+
"<label class='custom-file-label' id='custom-file-label' for='inputGroupFile01'>O arquivo deve ser no formato PDF de até 2mb.</label>"
+
"</div>"
+
"</div>"
+
"@error('anexoPlanoTrabalho')"
+
"<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"
+
"<strong>{{
$message
}}</strong>"
+
"</span>"
+
"@enderror"
+
"</div>"
+
"<div class="
+
"col-sm-1"
+
">"
+
"<a class="
+
"delete"
+
">"
+
"<img src="
+
"/img/icons/user-times-solid.svg"
+
" style="
+
"width:25px;margin-top:35px"
+
">"
+
"</a>"
+
"</div>"
+
//"</div>"+
"</div>"
;
}
function
areas
()
{
var
grandeArea
=
$
(
'#grandeArea'
)
.
val
();
$
.
getJSON
(
"{{ config('app.url') }}/naturezas/areas/"
+
grandeArea
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment