1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
@extends('layouts.app')
@section('content')
<div class="container content">
<div class="row justify-content-center">
<div class="col-sm-12">
<div class="card" style="margin-top:50px">
<div class="card-body">
<h5 class="card-title">Enviar Projeto</h5>
<p class="card-text">
<form method="POST" action="{{route('trabalho.store')}}" enctype="multipart/form-data">
@csrf
<input type="hidden" name="editalId" value="{{$edital->id}}">
{{-- Nome do Projeto --}}
<div class="row justify-content-center">
<div class="col-sm-12">
<label for="nomeProjeto" class="col-form-label">{{ __('Nome do Projeto*:') }}</label>
<input id="nomeProjeto" type="text" class="form-control @error('nomeProjeto') is-invalid @enderror" name="nomeProjeto" value="{{ old('nomeProjeto') !== null ? old('nomeProjeto') : (isset($rascunho) ? $rascunho->titulo : '')}}" autocomplete="nomeProjeto" autofocus>
@error('nomeProjeto')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
{{-- Grande Area --}}
<div class="row justify-content-center">
<div class="col-sm-4">
<label for="grandeArea" class="col-form-label">{{ __('Grande Área*:') }}</label>
<select class="form-control @error('grandeArea') is-invalid @enderror" id="grandeArea" name="grandeArea" onchange="areas()">
<option value="" disabled selected hidden>-- Grande Área --</option>
@foreach($grandeAreas as $grandeArea)
<option @if(old('grandeArea') !== null ? old('grandeArea') : (isset($rascunho) ? $rascunho->grande_area_id : '')
== $grandeArea->id ) selected @endif value="{{$grandeArea->id}}">{{$grandeArea->nome}}</option>
@endforeach
</select>
@error('grandeArea')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label for="area" class="col-form-label">{{ __('Área*:') }}</label>
<input type="hidden" id="oldArea" value="{{ old('area') }}">
<select class="form-control @error('area') is-invalid @enderror" id="area" name="area" onchange="subareas()">
<option value="" disabled selected hidden>-- Área --</option>
{{-- @foreach($areas as $area)
<option @if(old('area') !== null ? old('area') : (isset($rascunho) ? $rascunho->area_id : '')
==$area->id ) selected @endif value="{{$area->id}}">{{$area->nome}}</option>
@endforeach --}}
</select>
@error('area')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label for="subArea" class="col-form-label">{{ __('Sub Área*:') }}</label>
<input type="hidden" id="oldSubArea" value="{{ old('subArea') }}">
<select class="form-control @error('subArea') is-invalid @enderror" id="subArea" name="subArea">
<option value="" disabled selected hidden>-- Sub Área --</option>
{{-- @foreach($subAreas as $subArea)
<option @if(old('subArea') !== null ? old('subArea') : (isset($rascunho) ? $rascunho->sub_area_id : '')
==$subArea->id ) selected @endif value="{{$subArea->id}}">{{$subArea->nome}}</option>
@endforeach --}}
</select>
@error('subArea')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<hr>
<h3>Coordenador</h3>
{{-- Coordenador --}}
<div class="row justify-content-center">
<div class="col-sm-6">
<label for="nomeCoordenador" class="col-form-label">{{ __('Coordenador:') }}</label>
<input class="form-control" type="text" id="nomeCoordenador" name="nomeCoordenador" disabled="disabled" value="{{ Auth()->user()->name }}">
</div>
<div class="col-sm-6">
<label for="linkLattesEstudante" class="col-form-label">Link Lattes do Proponente*</label>
<input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante"
@if(Auth()->user()->proponentes != null && Auth()->user()->proponentes->linkLattes != null)
value="{{ Auth()->user()->proponentes->linkLattes }}"
@else
value=""
@endif >
@error('linkLattesEstudante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="pontuacaoPlanilha" class="col-form-label">{{ __('Pontuação da Planilha de Pontuação*:') }}</label>
<input class="form-control @error('pontuacaoPlanilha') is-invalid @enderror" type="text" name="pontuacaoPlanilha"
value="{{old('pontuacaoPlanilha') !== null ? old('pontuacaoPlanilha') : (isset($rascunho) ? $rascunho->pontuacaoPlanilha : '')}}">
@error('pontuacaoPlanilha')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="linkGrupo" class="col-form-label">{{ __('Link do grupo de pesquisa*:') }}</label>
<input class="form-control @error('linkGrupo') is-invalid @enderror" type="text" name="linkGrupo"
value="{{old('linkGrupo') !== null ? old('linkGrupo') : (isset($rascunho) ? $rascunho->linkGrupoPesquisa : '')}}">
@error('linkGrupo')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<hr>
<h3>Anexos</h3>
{{-- Anexo do Projeto --}}
<div class="row justify-content-center">
{{-- Arquivo --}}
<div class="col-sm-6">
<label for="anexoProjeto" class="col-form-label">{{ __('Anexo Projeto*:') }}</label>
@if(old('anexoProjetoPreenchido') != null || (isset($rascunho) && $rascunho->anexoProjeto != ""))
<a id="anexoProjetoTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'anexoProjeto' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoProjetoPreenchido" name="anexoProjetoPreenchido" value="{{ old('anexoProjetoPreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input @error('anexoProjeto') is-invalid @enderror" id="anexoProjeto" aria-describedby="inputGroupFileAddon01" name="anexoProjeto" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="anexoProjeto">O arquivo deve ser no formato PDF de até 2mb.</label>
</div>
</div>
@error('anexoProjeto')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="anexoLattesCoordenador" class="col-form-label">{{ __('Anexo do Lattes do Coordenador*:') }}</label>
@if(old('anexoLattesPreenchido') != null || (isset($rascunho) && $rascunho->anexoLattesCoordenador != ""))
<a id="anexoLattesTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'anexoLattesCoordenador' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoLattesPreenchido" name="anexoLattesPreenchido" value="{{ old('anexoLattesPreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input @error('anexoLattesCoordenador') is-invalid @enderror" id="anexoLattesCoordenador" aria-describedby="anexoLattesCoordenador" name="anexoLattesCoordenador" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="anexoLattesCoordenador">O arquivo deve ser no formato PDF de até 2mb.</label>
</div>
</div>
@error('anexoLattesCoordenador')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="botao" class="col-form-label @error('botao') is-invalid @enderror" data-toggle="tooltip" data-placement="bottom" title="Se possuir, coloque todas em único arquivo pdf.">{{ __('Possui autorizações especiais?*:') }}</label>
<button id="buttonSim" class="btn btn-primary mt-2 mb-2">Sim</button>
<button id="buttonNao" class="btn btn-primary mt-2 mb-2">Não</button>
<input type="hidden" id="botao" name="botao" value="">
@error('botao')
<span id="botao" class="invalid-feedback" role="alert" style="overflow: visible; display:inline">
<strong>{{ $message }}</strong>
</span>
@enderror
<br/>
@if(old('anexoComitePreenchido') != null || (isset($rascunho) && $rascunho->anexoAutorizacaoComiteEtica != "" && $rascunho->anexoAutorizacaoComiteEtica != null))
<a id="anexoComiteTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'anexoAutorizacaoComiteEtica' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoComitePreenchido" name="anexoComitePreenchido" value="{{ old('anexoComitePreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input disabled type="file" class="custom-file-input @error('anexoComiteEtica') is-invalid @enderror" id="inputEtica" aria-describedby="inputGroupFileAddon01" name="anexoComiteEtica" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="inputEtica">O arquivo deve ser no formato PDF de até 2mb.</label>
</div>
</div>
@error('anexoComiteEtica')
<span id="comiteErro" class="invalid-feedback" role="alert" style="overflow: visible; display:none">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6 mt-3">
<label for="anexoPlanilha" class="col-form-label">{{ __('Anexo do Planilha de Pontuação*:') }}</label>
@if(old('anexoPlanilhaPreenchido') != null || (isset($rascunho) && $rascunho->anexoPlanilhaPontuacao != ""))
<a id="anexoPlanilhaTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'anexoPlanilhaPontuacao' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoPlanilhaPreenchido" name="anexoPlanilhaPreenchido" value="{{ old('anexoPlanilhaPreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input @error('anexoPlanilha') is-invalid @enderror" id="anexoPlanilha" aria-describedby="anexoPlanilhaDescribe" name="anexoPlanilha" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="anexoPlanilha">O arquivo deve ser no formato PDF, XLS ou XLSX de até 2mb.</label>
</div>
</div>
@error('anexoPlanilha')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="nomeTrabalho" class="col-form-label">{{ __('Justificativa*:') }}</label>
@if(old('anexoJustificativaPreenchido') != null || (isset($rascunho) && $rascunho->justificativaAutorizacaoEtica != "" && $rascunho->justificativaAutorizacaoEtica != null))
<a id="anexoJustificativaTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'justificativaAutorizacaoEtica' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoJustificativaPreenchido" name="anexoJustificativaPreenchido" value="{{ old('anexoJustificativaPreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input @error('justificativaAutorizacaoEtica') is-invalid @enderror" id="inputJustificativa" aria-describedby="inputGroupFileAddon01" disabled name="justificativaAutorizacaoEtica" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="inputJustificativa">O arquivo deve ser no formato PDF de até 2mb.</label>
</div>
</div>
@error('justificativaAutorizacaoEtica')
<span id="justificativaErro" class="invalid-feedback" role="alert" style="overflow: visible; display:none">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
@if($edital->tipo == 'PIBIC' || $edital->tipo == 'PIBIC-EM')
{{-- Decisão do CONSU --}}
<div class="col-sm-6">
<label for="anexoCONSU" class="col-form-label">{{ __('Decisão do CONSU*:') }}</label>
@if(old('anexoConsuPreenchido') != null || (isset($rascunho) && $rascunho->anexoDecisaoCONSU != "" && $rascunho->anexoDecisaoCONSU != null))
<a id="anexoConsuTemp" href="{{ route('baixar.anexo.temp', ['eventoId' => $edital->id,
'nomeAnexo' => 'anexoDecisaoCONSU' ])}}">Arquivo atual</a>
@endif
<input type="hidden" id="anexoConsuPreenchido" name="anexoConsuPreenchido" value="{{ old('anexoConsuPreenchido') }}" >
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input @error('anexoCONSU') is-invalid @enderror" id="anexoCONSU" aria-describedby="inputGroupFileAddon01" name="anexoCONSU" onchange="exibirAnexoTemp(this)">
<label class="custom-file-label" id="custom-file-label" for="anexoCONSU">O arquivo deve ser no formato PDF de até 2mb.</label>
</div>
</div>
@error('anexoCONSU')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
@endif
</div>
<hr>
<h3>Participantes</h3>
{{-- Participantes --}}
<div class="row" style="margin-top:20px">
<div class="col-sm-12">
<div id="participantes">
@php $countParticipante = 1; @endphp
@if(old('countParticipante') != null)
@php $countParticipante = old('countParticipante') @endphp
@endif
@if ($countParticipante != null && $countParticipante > 0)
@for ($i = 0; $i < $countParticipante; $i++)
<div id="novoParticipante" style="display: block;">
<br>
<h4>Dados do participante</h4>
<div class="row">
<div class="col-sm-5">
<label>Nome Completo*</label>
<input type="text" style="margin-bottom:10px" class="form-control @error('nomeParticipante') is-invalid @enderror" name="nomeParticipante[]" placeholder="Nome" value="{{old('nomeParticipante.'.$i)}}">
@error('nomeParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label>E-mail*</label>
<input type="email" style="margin-bottom:10px" class="form-control @error('emailParticipante') is-invalid @enderror" name="emailParticipante[]" placeholder="email" value="{{old('emailParticipante.'.$i)}}">
@error('emailParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-3">
<label>Função*:</label>
<select class="form-control @error('funcaoParticipante') is-invalid @enderror" name="funcaoParticipante[]" id="funcaoParticipante">
<option value="" disabled selected hidden>-- Função --</option>
@foreach($funcaoParticipantes as $funcaoParticipante)
<option @if(old('funcaoParticipante.'.$i)==$funcaoParticipante->id ) selected @endif value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option>
@endforeach
@error('funcaoParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</select>
</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 naoPlano">Não</button>
<div id="planoHabilitado" >
<h5>Dados do plano de trabalho</h5>
<div class="row">
<div class="col-sm-12">
<div id="planoTrabalho">
<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" value="{{old('nomePlanoTrabalho.'.$i)}}">
@error('nomePlanoTrabalho')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
{{-- Arquivo --}}
<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="anexoPlanoTrabalho">Selecione um arquivo:</span>
</div>
<div class="custom-file">
<input type="file" class="custom-file-input @error('anexoPlanoTrabalho') is-invalid @enderror" id="anexoPlanoTrabalho" aria-describedby="anexoPlanoTrabalho" 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="{{ asset('/img/icons/user-times-solid.svg') }}" style="width:25px;margin-top:35px">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endfor
@endif
</div>
<input type="hidden" name="countParticipante" id="countParticipante" value="{{ old('countParticipante') != null ? old('countParticipante') : 1}}">
<a href="#" class="btn btn-primary" id="addCoautor" style="width:100%;margin-top:10px">Participantes +</a>
</div>
</div>
</p>
<div class="row justify-content-center">
<div class="col-md-6">
<button type="submit" formaction="{{route('trabalho.storeParcial')}}" class="btn btn-primary" style="width:100%;margin-bottom:10px">
{{ __('Salvar como Rascunho') }}
</button>
</div>
<div class="col-md-6">
<button type="submit" class="btn btn-primary" style="width:100%">
{{ __('Enviar Projeto') }}
</button>
</div>
</div>
<a href="{{route('evento.visualizar',['id'=>$edital->id])}}" class="btn btn-secondary" style="width:100%">Cancelar</a>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script type="text/javascript">
$(function() {
var qtdLinhas = 1;
// Coautores
$('#addCoautor').click(function(e) {
var countParticipante = document.getElementById('countParticipante');
if (countParticipante.value < 100) {
e.preventDefault();
linha = montarLinhaInput();
$('#participantes').append(linha);
setParticipanteDiv(parseInt(countParticipante.value) + 1);
}
});
function setParticipanteDiv(qtdParticipante) {
var countParticipante = document.getElementById('countParticipante');
countParticipante.value = qtdParticipante;
}
$('#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() {
var countParticipante = document.getElementById('countParticipante');
if (countParticipante.value >= 2) {
setParticipanteDiv(parseInt(countParticipante.value) - 1);
$(this).closest('#novoParticipante').remove();
return false;
}
});
$(document).on('click', '.deletePlano', function() {
if (qtdLinhas > 1) {
qtdLinhas--;
$("#planoTrabalho div.row:last").remove();
return false;
}
});
$('.custom-file-input').on('change', function() {
var fieldVal = $(this).val();
// Change the node's value by removing the fake path (Chrome)
fieldVal = fieldVal.replace("C:\\fakepath\\", "");
if (fieldVal != undefined || fieldVal != "") {
$(this).next(".custom-file-label").attr('data-content', fieldVal);
$(this).next(".custom-file-label").text(fieldVal);
}
})
// F
$('#buttonSim').on('click', function(e) {
e.preventDefault();
$('#inputEtica').prop('disabled', false);
$('#inputJustificativa').prop('disabled', true);
exibirErro('comite');
// $('#anexoJustificativaPreenchido').val("");
});
$('#buttonNao').on('click', function(e) {
e.preventDefault();
$('#inputEtica').prop('disabled', true);
$('#inputJustificativa').prop('disabled', false);
exibirErro('justificativa');
//$('#anexoComitePreenchido').val("");
});
// document.getElementsByClassName('.simPlano .naoPlano').addEventListener("click", function(event){
// event.preventDefault()
// });
$(document).on('click', '.simPlano', function(e) {
e.preventDefault();
var plano = $(this).next().next()[0];
plano.style.display = 'block';
});
$(document).on('click', '.naoPlano', function(e) {
e.preventDefault();
var plano = $(this).next()[0];
plano.style.display = 'none';
});
});
function exibirErro(campo) {
var botao = document.getElementById('botao');
botao.value = "sim";
var comiteErro = document.getElementById('comiteErro');
var justificativaErro = document.getElementById('justificativaErro');
if(comiteErro != null || justificativaErro != null){
if (campo === 'comite') {
comiteErro.style.display = "block";
justificativaErro.style.display = "none";
} else if (campo === 'justificativa') {
comiteErro.style.display = "none";
justificativaErro.style.display = "block";
}
}
}
function habilitarBotao(){
var anexoComitePreenchido = document.getElementById('anexoComitePreenchido');
var anexoJustificativaPreenchido = document.getElementById('anexoJustificativaPreenchido');
if(anexoComitePreenchido.value == "sim"){
$('#inputEtica').prop('disabled', false);
$('#inputJustificativa').prop('disabled', true);
exibirErro('comite');
} else if(anexoJustificativaPreenchido.value == "sim"){
$('#inputEtica').prop('disabled', true);
$('#inputJustificativa').prop('disabled', false);
exibirErro('justificativa');
}
}
// Remover Coautor
// function addModalidade(areaId) {
// console.log(modalidades)
// $("#modalidade").empty();
// for (let i = 0; i < modalidades.length; i++) {
// if (modalidades[i].areaId == areaId) {
// console.log(modalidades[i]);
// $("#modalidade").append("<option value=" + modalidades[i].modalidadeId + ">" + modalidades[i].modalidadeNome + "</option>")
// }
// }
// }
function montarLinhaInput() {
return "<div id="+"novoParticipante"+">" +
"<br><h4>Dados do participante</h4>" +
"<div class="+"row"+">"+
"<div class="+"col-sm-5"+">"+
"<label>Nome Completo*</label>"+
"<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control' + " @error('nomeParticipante') is-invalid @enderror" + "name=" +'nomeParticipante[]'+" placeholder="+"Nome"+">"+
"@error('nomeParticipante')" +
"<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" +
"<strong>{{ $message }}</strong>" +
"</span>" +
"@enderror" +
"</div>"+
"<div class="+"col-sm-4"+">"+
"<label>E-mail*</label>"+
"<input type='email'" + "style='margin-bottom:10px'" + "class=" + "form-control @error('emailParticipante') is-invalid @enderror" + "name='emailParticipante[]'" + "placeholder='email' >" +
"@error('emailParticipante')" +
"<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" +
"<strong>{{ $message }}</strong>" +
"</span>" +
"@enderror" +
"</div>"+
"<div class='col-sm-3'>"+
"<label>Função*:</label>"+
"<select class=" + "form-control @error('funcaoParticipante') is-invalid @enderror" + "name='funcaoParticipante[]'" + "id='funcaoParticipante'> " +
"<option value='' disabled selected hidden> Função </option>"+
"@foreach($funcaoParticipantes as $funcaoParticipante)"+
"<option value='{{$funcaoParticipante->id}}'>{{$funcaoParticipante->nome}}</option>"+
"@endforeach"+
"@error('funcaoParticipante')" +
"<span class='invalid-feedback'" + "role='alert'" + "style='overflow: visible; display:block'>" +
"<strong>{{ $message }}</strong>" +
"</span>" +
"@enderror" +
"</select>"+
"</div>"+
"</div>" +
"<h6 class='mb-1'>Possui plano de trabalho?</h6>"+
"<button class="+"'btn btn-primary mt-2 mb-2 mr-1 simPlano'"+">Sim</button>"+
"<button class="+"'btn btn-primary mt-2 mb-2 naoPlano'"+">Não</button>"+
"<div id="+"planoHabilitado"+">" +
"<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>"+
"</div>";
}
// function montarLinhaInputPlanoTrabalho(){
// return "<div class="+"row"+">"+
// "<div class="+"col-sm-4"+">"+
// "<label>Nome Completo</label>"+
// "<input"+" type="+'text'+" style="+"margin-bottom:10px"+" class="+'form-control emailCoautor'+" name="+'nomePlanoTrabalho[]'+" placeholder="+"Nome"+" required>"+
// "</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' 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('arquivo')"+
// "<span class='invalid-feedback' role='alert' style='overflow: visible; display:block'>"+
// "<strong>{{ $message }}</strong>"+
// "</span>"+
// "@enderror"+
// "</div>"+
// "<div class="+"col-sm-1"+">"+
// "<a class="+"deletePlano"+">"+
// "<img src="+"/img/icons/user-times-solid.svg"+" style="+"width:25px;margin-top:35px"+">"+
// "</a>"+
// "</div>"+
// "</div>";
// }
function areas() {
var grandeArea = $('#grandeArea').val();
$.ajax({
type: 'POST',
url: '{{ route('area.consulta') }}',
data: 'id='+grandeArea ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados) => {
if (dados.length > 0) {
if($('#oldArea').val() == null || $('#oldArea').val() == ""){
var option = '<option selected disabled>-- Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldArea').val() != null && $('#oldArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Área --</option>";
}
$('#area').html(option).show();
subareas();
},
error: (data) => {
console.log(data);
}
})
}
function subareas() {
var area = $('#area').val();
$.ajax({
type: 'POST',
url: '{{ route('subarea.consulta') }}',
data: 'id='+area ,
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: (dados)=> {
if (dados.length > 0) {
if($('#oldSubArea').val() == null || $('#oldSubArea').val() == ""){
var option = '<option selected disabled>-- Sub Área --</option>';
}
$.each(dados, function(i, obj) {
if($('#oldSubArea').val() != null && $('#oldSubArea').val() == obj.id){
option += '<option selected value="' + obj.id + '">' + obj.nome + '</option>';
}else{
option += '<option value="' + obj.id + '">' + obj.nome + '</option>';
}
})
} else {
var option = "<option selected disabled>-- Sub Área --</option>";
}
$('#subArea').html(option).show();
},
error: (dados) => {
console.log(dados);
}
})
}
function exibirAnexoTemp(file){
if(file.id === "anexoProjeto"){
var anexoProjetoPreenchido = document.getElementById('anexoProjetoPreenchido');
anexoProjetoPreenchido.value = "sim";
}
if(file.id === "anexoLattesCoordenador"){
var anexoLattesPreenchido = document.getElementById('anexoLattesPreenchido');
anexoLattesPreenchido.value = "sim";
}
if(file.id === "inputEtica"){
var anexoComitePreenchido = document.getElementById('anexoComitePreenchido');
var anexoJustificativaPreenchido = document.getElementById('anexoJustificativaPreenchido');
anexoComitePreenchido.value = "sim";
anexoJustificativaPreenchido.value = "";
}
if(file.id === "inputJustificativa"){
var anexoComitePreenchido = document.getElementById('anexoComitePreenchido');
var anexoJustificativaPreenchido = document.getElementById('anexoJustificativaPreenchido');
anexoJustificativaPreenchido.value = "sim";
anexoComitePreenchido.value = "";
}
if(file.id === "anexoCONSU"){
var anexoConsuPreenchido = document.getElementById('anexoConsuPreenchido');
anexoConsuPreenchido.value = "sim";
}
if(file.id === "anexoPlanilha"){
var anexoPlanilhaPreenchido = document.getElementById('anexoPlanilhaPreenchido');
anexoPlanilhaPreenchido.value = "sim";
}
}
window.onload = areas();
window.onload = habilitarBotao();
</script>
@endsection