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
pad-upe
Commits
8920b61e
Commit
8920b61e
authored
Mar 26, 2023
by
Gabriel
Browse files
adicionando migrations e telas para implementar lógica de avaliador
parent
523dc609
Changes
10
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/PadController.php
View file @
8920b61e
...
@@ -208,13 +208,17 @@ class PadController extends Controller
...
@@ -208,13 +208,17 @@ class PadController extends Controller
$menu
=
Menu
::
PADS
;
$menu
=
Menu
::
PADS
;
$pad
=
PAD
::
find
(
$id
);
$pad
=
PAD
::
find
(
$id
);
$userPads
=
$pad
->
userPads
;
$userPads
=
$pad
->
userPads
;
$avaliatorsPads
=
$pad
->
avaliadorPads
;
$status
=
Constants
::
listStatus
();
$status
=
Constants
::
listStatus
();
return
view
(
'pad.admin.edit'
,
[
return
view
(
'pad.admin.edit'
,
[
'pad'
=>
$pad
,
'pad'
=>
$pad
,
'menu'
=>
$menu
,
'menu'
=>
$menu
,
'status'
=>
$status
,
'status'
=>
$status
,
'userPads'
=>
$userPads
,
'userPads'
=>
$userPads
,
'avaliatorsPads'
=>
$avaliatorsPads
]);
]);
}
}
...
...
app/Models/AvaliadorPad.php
View file @
8920b61e
...
@@ -25,4 +25,13 @@ class AvaliadorPad extends Model
...
@@ -25,4 +25,13 @@ class AvaliadorPad extends Model
public
static
function
find
()
{
public
static
function
find
()
{
return
new
UserPadQuery
(
get_called_class
());
return
new
UserPadQuery
(
get_called_class
());
}
}
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
);
}
public
function
dimensions
()
{
return
$this
->
hasMany
(
Dimension
::
class
);
}
}
}
app/Models/AvaliadorPadDimensao.php
0 → 100644
View file @
8920b61e
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
AvaliadorPadDimensao
extends
Model
{
protected
$table
=
'avaliador_pad_dimensao'
;
protected
$fillable
=
[
'id'
,
'avaliador_pad_id'
,
'dimensao'
];
protected
$dates
=
[
'deleted_at'
];
public
function
avaliadorPad
()
{
return
$this
->
belongsTo
(
AvaliadorPad
::
class
);
}
}
app/Models/Pad.php
View file @
8920b61e
...
@@ -49,5 +49,13 @@ class Pad extends Model
...
@@ -49,5 +49,13 @@ class Pad extends Model
public
function
userPads
()
{
public
function
userPads
()
{
return
$this
->
hasMany
(
UserPad
::
class
);
return
$this
->
hasMany
(
UserPad
::
class
);
}
}
/**
* @return Illuminate\Database\Eloquent\Collection
* @return Collection<AvaliadorPad>
*/
public
function
avaliadorPads
(){
return
$this
->
hasMany
(
AvaliadorPad
::
class
);
}
}
}
database/migrations/2023_03_13_220732_alter_avaliador_pad_remove_dimensao_and_add_status_table.php
0 → 100644
View file @
8920b61e
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AlterAvaliadorPadRemoveDimensaoAndAddStatusTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'avaliador_pad'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'dimensao'
);
$table
->
tinyInteger
(
'status'
)
->
after
(
'pad_id'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'avaliador_pad'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'status'
);
$table
->
tinyInteger
(
'dimensao'
)
->
after
(
'id'
);
});
}
}
database/migrations/2023_03_13_221712_create_avaliador_pad_dimensao_table.php
0 → 100644
View file @
8920b61e
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateAvaliadorPadDimensaoTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'avaliador_pad_dimensao'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
foreignId
(
'avaliador_pad_id'
)
->
constrained
(
'avaliador_pad'
);
$table
->
tinyInteger
(
'dimensao'
);
$table
->
softDeletes
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'avaliador_pad_dimensao'
);
}
}
resources/views/avaliador-pad/_form.blade.php
0 → 100644
View file @
8920b61e
@
php
function
field_validate
(
$field
)
{
$type_form
=
'create_and_update'
;
return
sprintf
(
"%s_%s"
,
$type_form
,
$field
);
}
@
endphp
<
div
class
=
"row"
>
<
input
type
=
"hidden"
name
=
"pad_id"
id
=
"pad_id"
value
=
"{{
$pad->id
}}"
>
<
div
class
=
"mb-3 col-sm-12"
>
<
label
class
=
"form-label"
for
=
"user_id"
>
Professor
</
label
>
<
select
class
=
"form-select @error('user_id') is-invalid @enderror ajax-errors"
name
=
"user_id"
id
=
"user_id"
>
<
option
value
=
"0"
>
Selecione
um
Professor
</
option
>
@
foreach
(
$users
as
$user
)
@
if
(
$user
->
id
==
$model
->
user_id
)
<
option
selected
value
=
"
{
{$user->id}}">{{$user->name}
}
</option>
@else
<option value="
{{
$user
->
id
}}
">
{
{$user->name}
}
</option>
@endif
@endforeach
</select>
@include('components.divs.errors', [
'field' => field_validate('user_id')
])
</div>
<div class="
mb
-
3
col
-
sm
-
6
">
<label class="
form
-
label
" for="
pad_name
"> PAD </label>
<input class="
form
-
control
" type="
text
" disabled value="
{{
$pad
->
nome
}}
">
</div>
<div class="
mb
-
3
col
-
sm
-
6
">
<label class="
form
-
label
" for="
status
">Status</label>
<select class="
form
-
select
@
error
(
'status'
)
is
-
invalid
@
enderror
ajax
-
errors
" name="
status
" id="
status
">
<option value="
0
">Selecione um Status</option>
@foreach(
$status
as
$value
=>
$stat
)
@if(
$value
==
$model->status
)
<option selected value="
{{
$value
}}
">
{
{$stat}
}
</option>
@else
<option value="
{{
$value
}}
">
{
{$stat}
}
</option>
@endif
@endforeach
</select>
@include('components.divs.errors', [
'field' => field_validate('nivel')
])
</div>
</div>
resources/views/avaliador-pad/create.blade.php
0 → 100644
View file @
8920b61e
<div
class=
"mb-3"
>
<h3
class=
"h3"
>
Cadastrar Professor (PAD)
</h3>
</div>
<form
id=
"form-user_pad"
action=
"{{ route('user-pad_store') }}"
method=
"post"
>
@csrf
@method('POST')
@include('user-pad._form', [
'pad' => $pad,
'model' => $model,
'users' => $users,
'status' => $status,
])
<div
class=
"mt-1 text-end"
>
<div
class=
"modal-footer"
>
@include('components.buttons.btn-save', [
'id' => 'btn_submit',
'content' => 'Cadastrar',
])
@include('components.buttons.btn-close_modal')
</div>
</div>
</form>
@include('pad.components.scripts.ajaxValidation', [
'btn_submit_id' => 'btn_submit',
'form_id' => 'form-user_pad',
'form_type' => 'create_and_update',
'route' => route('user-pad_ajax_validation'),
])
\ No newline at end of file
resources/views/avaliador-pad/update.blade.php
0 → 100644
View file @
8920b61e
resources/views/pad/admin/edit.blade.php
View file @
8920b61e
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
<
li
class
=
"nav-item"
role
=
"presentation"
>
<
li
class
=
"nav-item"
role
=
"presentation"
>
<
button
class
=
"nav-link"
id
=
"user_pad-tab"
data
-
bs
-
toggle
=
"tab"
data
-
bs
-
target
=
"#user_pad-container"
type
=
"button"
role
=
"tab"
aria
-
controls
=
"user_pad-container"
arial
-
selected
=
"false"
>
Professores
</
button
>
<
button
class
=
"nav-link"
id
=
"user_pad-tab"
data
-
bs
-
toggle
=
"tab"
data
-
bs
-
target
=
"#user_pad-container"
type
=
"button"
role
=
"tab"
aria
-
controls
=
"user_pad-container"
arial
-
selected
=
"false"
>
Professores
</
button
>
</
li
>
</
li
>
<
li
class
=
"nav-item"
role
=
"presentation"
>
<
button
class
=
"nav-link"
id
=
"avaliator_pad-tab"
data
-
bs
-
toggle
=
"tab"
data
-
bs
-
target
=
"#avaliator_pad-container"
type
=
"button"
role
=
"tab"
aria
-
controls
=
"avaliator_pad-container"
arial
-
selected
=
"false"
>
Avaliadores
</
button
>
</
li
>
</
ul
>
</
ul
>
</
div
>
</
div
>
...
@@ -137,8 +140,51 @@
...
@@ -137,8 +140,51 @@
</div>
</div>
<div id="
avaliator_pad
-
container
" class="
tab
-
pane
fade
" role="
tabpanel
" aria-labelledby="
user_pad
-
tab
">
<div class="
border
rounded
px
-
2
">
<div class="
text
-
end
my
-
2
">
<button type="
button
" class="
btn
btn
-
success
valiator
-
pad
-
create
"> Cadastrar Avaliador </button>
</div>
<table id="
avaliator_pad
-
table
" class="
table
table
-
hover
">
<thead>
<tr>
<th scope="
col
"> Professor </th>
<th scope="
col
"> PAD </th>
<th scope="
col
"> Dimensão </th>
<th scope="
col
"> Opções </th>
</tr>
</thead>
<tbody>
@foreach(
$avaliatorsPads
as
$avaliatorPad
)
<tr>
<td>{{
$avaliatorPad->user
->name }}</td>
<td>{{
$avaliatorPad->pad
->nome }}</td>
<td>
{{-- @foreach(
$avaliatorPad->dimensions
as
$dimension
)
<span class="
badge
bg
-
primary
">{{
$dimension->nome
}}</span>
@endforeach --}}
</td>
<td>{{
$avaliatorPad->dimensao
}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@include('components.modal', ['size' => 'modal-lg'])
@include('components.modal', ['size' => 'modal-lg'])
@endsection
@endsection
...
@@ -151,4 +197,9 @@
...
@@ -151,4 +197,9 @@
'btn_class' => 'user-pad-create',
'btn_class' => 'user-pad-create',
])
])
@include('pad.components.scripts.dimensao.ensino.show_modal', [
'modal_id' => 'modal',
'route' => route('user-pad_create', ['pad_id' =>
$pad->id
]),
'btn_class' => 'valiator-pad-create',
])
@endsection
@endsection
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