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
cbdb1f6b
"...views/evento/git@sites.upe.br:walter.felipe/submeta.git" did not exist on "3bc67fa99eb68bef2c89b18b6b83326b60a38ecf"
Commit
cbdb1f6b
authored
Jan 16, 2023
by
alissonalbuquerque
Browse files
Feliz Ano Novo
parent
4084cbe2
Changes
26
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/PadController.php
View file @
cbdb1f6b
...
@@ -127,10 +127,16 @@ class PadController extends Controller
...
@@ -127,10 +127,16 @@ class PadController extends Controller
*/
*/
public
function
create
()
public
function
create
()
{
{
$menu
=
Menu
::
PADS
;
$status
=
[
$status
=
[
Status
::
ATIVO
=>
Status
::
listStatus
(
Status
::
ATIVO
)
Status
::
ATIVO
=>
Status
::
listStatus
(
Status
::
ATIVO
)
];
];
return
view
(
'pad.admin.create'
,
[
'status'
=>
$status
]);
return
view
(
'pad.admin.create'
,
[
'menu'
=>
$menu
,
'status'
=>
$status
]);
}
}
/**
/**
...
@@ -199,10 +205,17 @@ class PadController extends Controller
...
@@ -199,10 +205,17 @@ class PadController extends Controller
*/
*/
public
function
edit
(
$id
)
public
function
edit
(
$id
)
{
{
$menu
=
Menu
::
PADS
;
$pad
=
PAD
::
find
(
$id
);
$pad
=
PAD
::
find
(
$id
);
$userPads
=
$pad
->
userPads
;
$status
=
Constants
::
listStatus
();
$status
=
Constants
::
listStatus
();
return
view
(
'pad.admin.edit'
,
[
'pad'
=>
$pad
,
'status'
=>
$status
]);
return
view
(
'pad.admin.edit'
,
[
'pad'
=>
$pad
,
'menu'
=>
$menu
,
'status'
=>
$status
,
'userPads'
=>
$userPads
,
]);
}
}
/**
/**
...
...
app/Http/Controllers/UserController.php
View file @
cbdb1f6b
...
@@ -10,6 +10,7 @@ use App\Models\Util\Status;
...
@@ -10,6 +10,7 @@ use App\Models\Util\Status;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Session
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Storage
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\HeadingRowImport
;
use
Maatwebsite\Excel\HeadingRowImport
;
...
@@ -78,7 +79,11 @@ class UserController extends Controller
...
@@ -78,7 +79,11 @@ class UserController extends Controller
public
function
actionStore
(
Request
$request
)
public
function
actionStore
(
Request
$request
)
{
{
$request
->
validate
(
User
::
ruleDefault
(),
User
::
messages
());
$validator
=
User
::
validator
(
$request
->
all
());
if
(
$validator
->
fails
())
{
return
redirect
()
->
route
(
'user_create'
)
->
withErrors
(
$validator
);
}
$model
=
new
User
();
$model
=
new
User
();
$model
->
fill
(
$request
->
all
());
$model
->
fill
(
$request
->
all
());
...
@@ -88,26 +93,31 @@ class UserController extends Controller
...
@@ -88,26 +93,31 @@ class UserController extends Controller
$password
=
array_shift
(
$email_splited
);
$password
=
array_shift
(
$email_splited
);
$model
->
password
=
Hash
::
make
(
$password
);
$model
->
password
=
Hash
::
make
(
$password
);
if
(
$model
->
save
())
if
(
$model
->
save
())
{
{
return
redirect
()
->
route
(
'user_edit'
,
[
'id'
=>
$model
->
id
])
->
with
(
'success'
,
'Usuário cadastrado com sucesso!'
);
return
redirect
()
->
route
(
'user_edit'
,
[
'id'
=>
$model
->
id
])
->
with
(
'success'
,
'Usuário cadastrado com sucesso!'
);
}
}
return
redirect
()
->
with
(
'fail'
,
'Falha ao cadastrar Usuário!'
);
return
redirect
()
->
with
(
'fail'
,
'Falha ao cadastrar Usuário!'
);
}
}
public
function
actionEdit
(
$id
)
public
function
actionEdit
(
Request
$request
,
$id
)
{
{
$model
=
User
::
find
(
$id
);
$model
=
User
::
find
(
$id
);
$profiles
=
$model
->
profiles
;
$status
=
[
$status
=
[
Status
::
ATIVO
=>
Status
::
listStatus
(
Status
::
ATIVO
),
Status
::
ATIVO
=>
Status
::
listStatus
(
Status
::
ATIVO
),
Status
::
INATIVO
=>
Status
::
listStatus
(
Status
::
INATIVO
)
Status
::
INATIVO
=>
Status
::
listStatus
(
Status
::
INATIVO
)
];
];
if
(
count
(
$profiles
)
<=
0
)
{
Session
::
flash
(
'warning'
,
'Não existem papeis cadastrados para esse usuário!'
);
}
return
view
(
'users.update'
,
[
return
view
(
'users.update'
,
[
'menu'
=>
Menu
::
USERS
,
'menu'
=>
Menu
::
USERS
,
'model'
=>
$model
,
'model'
=>
$model
,
'status'
=>
$status
,
'status'
=>
$status
,
'profiles'
=>
$profiles
,
]);
]);
}
}
...
...
app/Http/Controllers/UserPadController.php
0 → 100644
View file @
cbdb1f6b
<?php
namespace
App\Http\Controllers
;
use
App\Models\Pad
;
use
App\Models\User
;
use
App\Models\UserPad
;
use
App\Models\Util\Status
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Response
;
use
Illuminate\Support\Facades\Validator
;
class
UserPadController
extends
Controller
{
public
function
actionStore
(
Request
$request
)
{
$validator
=
Validator
::
make
(
$request
->
all
(),
UserPad
::
rules
(),
UserPad
::
messages
()
);
if
(
$validator
->
fails
())
{
}
$model
=
new
UserPad
();
$model
->
fill
(
$request
->
all
());
$model
->
save
();
$pad
=
Pad
::
find
(
$request
->
pad_id
);
return
redirect
()
->
route
(
'pad_edit'
,
[
'id'
=>
$request
->
pad_id
])
->
with
(
'success'
,
sprintf
(
'Professor cadastrado no PAD(%s) com Sucesso!'
,
$pad
->
nome
));
}
public
function
actionUpdate
(
Request
$request
,
$id
)
{
}
public
function
actionDelete
(
$id
)
{
}
public
function
actionCreate
(
$pad_id
)
{
$pad
=
Pad
::
find
(
$pad_id
);
$model
=
new
UserPad
();
$status
=
Status
::
listStatus
();
$users
=
User
::
all
();
return
view
(
'user-pad.create'
,
[
'pad'
=>
$pad
,
'model'
=>
$model
,
'users'
=>
$users
,
'status'
=>
$status
,
]);
}
public
function
actionEdit
(
$id
)
{
}
public
function
ajaxValidation
(
Request
$request
)
{
$validator
=
Validator
::
make
(
$request
->
all
(),
UserPad
::
rules
(),
UserPad
::
messages
()
);
if
(
$validator
->
passes
())
{
return
Response
::
json
([
'message'
=>
true
,
'status'
=>
200
]);
}
return
Response
::
json
([
'errors'
=>
$validator
->
errors
(),
'status'
=>
400
]);
}
}
app/Http/Controllers/UserTypeController.php
0 → 100644
View file @
cbdb1f6b
<?php
namespace
App\Http\Controllers
;
use
App\Models\User
;
use
App\Models\UserType
;
use
App\Models\Util\Status
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Response
;
use
Illuminate\Support\Facades\Validator
;
class
UserTypeController
extends
Controller
{
public
function
actionStore
(
Request
$request
)
{
$validator
=
Validator
::
make
(
$request
->
all
(),
UserType
::
rules
(),
UserType
::
messages
()
);
if
(
$validator
->
fails
())
{
}
$model
=
new
UserType
();
$model
->
fill
(
$request
->
all
());
$model
->
selected
=
true
;
$model
->
save
();
return
redirect
()
->
route
(
'user_edit'
,
[
'id'
=>
$request
->
user_id
])
->
with
(
'success'
,
'Papel cadastrado com Sucesso!'
);
}
public
function
actionUpdate
(
Request
$request
,
$id
)
{
}
public
function
actionDelete
(
$id
)
{
}
public
function
actionCreate
(
$user_id
)
{
$model
=
new
UserType
();
$user
=
User
::
find
(
$user_id
);
$types
=
UserType
::
listType
();
$status
=
Status
::
listUserTypeStatus
();
return
view
(
'user-type.create'
,
[
'user'
=>
$user
,
'model'
=>
$model
,
'types'
=>
$types
,
'status'
=>
$status
,
]);
}
public
function
actionEdit
(
$id
)
{
$model
=
UserType
::
find
(
$id
);
$user
=
$model
->
user
;
$types
=
UserType
::
listType
();
$status
=
Status
::
listUserTypeStatus
();
return
view
(
'user-type.update'
,
[
'user'
=>
$user
,
'model'
=>
$model
,
'types'
=>
$types
,
'status'
=>
$status
,
]);
}
public
function
ajaxValidation
(
Request
$request
)
{
$validator
=
Validator
::
make
(
$request
->
all
(),
UserType
::
rules
(),
UserType
::
messages
()
);
if
(
$validator
->
passes
())
{
return
Response
::
json
([
'message'
=>
true
,
'status'
=>
200
]);
}
return
Response
::
json
([
'errors'
=>
$validator
->
errors
(),
'status'
=>
400
]);
}
}
app/Models/Pad.php
View file @
cbdb1f6b
...
@@ -12,22 +12,42 @@ class Pad extends Model
...
@@ -12,22 +12,42 @@ class Pad extends Model
{
{
use
HasFactory
;
use
HasFactory
;
/** @var string */
protected
$table
=
'pad'
;
protected
$table
=
'pad'
;
/** @var array */
protected
$fillable
=
[
'id'
,
'nome'
,
'data_inicio'
,
'data_fim'
,
'status'
];
protected
$fillable
=
[
'id'
,
'nome'
,
'data_inicio'
,
'data_fim'
,
'status'
];
/** @var array */
protected
$dates
=
[
'deleted_at'
];
protected
$dates
=
[
'deleted_at'
];
/**
* @return string
* */
public
function
statusAsString
()
{
public
function
statusAsString
()
{
return
Status
::
listStatus
(
$this
->
status
);
return
Status
::
listStatus
(
$this
->
status
);
}
}
/**
* @return string
*/
public
function
getDateInicio
()
{
public
function
getDateInicio
()
{
return
Carbon
::
parse
(
$this
->
data_inicio
)
->
format
(
'd/m/Y'
);
return
Carbon
::
parse
(
$this
->
data_inicio
)
->
format
(
'd/m/Y'
);
}
}
/**
* @return string
*/
public
function
getDateFim
()
{
public
function
getDateFim
()
{
return
Carbon
::
parse
(
$this
->
data_fim
)
->
format
(
'd/m/Y'
);
return
Carbon
::
parse
(
$this
->
data_fim
)
->
format
(
'd/m/Y'
);
}
}
/**
* @return Illuminate\Database\Eloquent\Collection
* @return Collection<UserPad>
*/
public
function
userPads
()
{
return
$this
->
hasMany
(
UserPad
::
class
);
}
}
}
app/Models/User.php
View file @
cbdb1f6b
...
@@ -19,28 +19,24 @@ class User extends Authenticatable
...
@@ -19,28 +19,24 @@ class User extends Authenticatable
/**
/**
* The attributes that are mass assignable.
* The attributes that are mass assignable.
*
* @var array<int, string>
* @var array<int, string>
*/
*/
protected
$fillable
=
[
'name'
,
'email'
,
'password'
,
'status'
,
'curso_id'
,
'campus_id'
];
protected
$fillable
=
[
'name'
,
'email'
,
'password'
,
'status'
,
'curso_id'
,
'campus_id'
];
/**
/**
* The attributes that should be hidden for serialization.
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
* @var array<int, string>
*/
*/
protected
$hidden
=
[
'password'
,
'remember_token'
];
protected
$hidden
=
[
'password'
,
'remember_token'
];
/**
/**
* The attributes that should be cast.
* The attributes that should be cast.
*
* @var array<string, string>
* @var array<string, string>
*/
*/
protected
$casts
=
[
protected
$casts
=
[
'email_verified_at'
=>
'datetime'
'email_verified_at'
=>
'datetime'
];
];
public
static
function
validator
(
array
$attributes
)
public
static
function
validator
(
array
$attributes
)
{
{
$rules
=
[
$rules
=
[
...
...
app/Models/UserPad.php
View file @
cbdb1f6b
...
@@ -38,8 +38,10 @@ class UserPad extends Model
...
@@ -38,8 +38,10 @@ class UserPad extends Model
{
{
use
HasFactory
;
use
HasFactory
;
/** @var string */
protected
$table
=
'user_pad'
;
protected
$table
=
'user_pad'
;
/** @var array */
protected
$fillable
=
[
'id'
,
'user_id'
,
'pad_id'
,
'status'
];
protected
$fillable
=
[
'id'
,
'user_id'
,
'pad_id'
,
'status'
];
public
function
user
()
{
public
function
user
()
{
...
@@ -58,6 +60,18 @@ class UserPad extends Model
...
@@ -58,6 +60,18 @@ class UserPad extends Model
return
new
UserPadQuery
(
get_called_class
());
return
new
UserPadQuery
(
get_called_class
());
}
}
public
static
function
rules
()
{
return
[
];
}
public
static
function
messages
()
{
return
[
];
}
public
function
totalHoras
()
public
function
totalHoras
()
{
{
$ensinoTotalHoras
=
$ensinoTotalHoras
=
...
...
app/Models/UserType.php
View file @
cbdb1f6b
...
@@ -29,11 +29,17 @@ class UserType extends Model
...
@@ -29,11 +29,17 @@ class UserType extends Model
return
$this
->
belongsTo
(
Pad
::
class
);
return
$this
->
belongsTo
(
Pad
::
class
);
}
}
/**
* @return string
*/
public
function
typeAsString
()
public
function
typeAsString
()
{
{
return
self
::
listType
(
$this
->
type
);
return
self
::
listType
(
$this
->
type
);
}
}
/**
* @return string
*/
public
function
statusAsString
()
public
function
statusAsString
()
{
{
return
Status
::
listStatus
(
$this
->
status
);
return
Status
::
listStatus
(
$this
->
status
);
...
@@ -44,6 +50,18 @@ class UserType extends Model
...
@@ -44,6 +50,18 @@ class UserType extends Model
return
new
UserTypeQuery
(
get_called_class
());
return
new
UserTypeQuery
(
get_called_class
());
}
}
public
static
function
rules
()
{
return
[
];
}
public
static
function
messages
()
{
return
[
];
}
public
static
function
listType
(
$value
=
null
)
{
public
static
function
listType
(
$value
=
null
)
{
$values
=
[
$values
=
[
...
...
app/Models/Util/Status.php
View file @
cbdb1f6b
...
@@ -23,4 +23,14 @@ class Status
...
@@ -23,4 +23,14 @@ class Status
return
$value
!==
null
?
$values
[
$value
]
:
$values
;
return
$value
!==
null
?
$values
[
$value
]
:
$values
;
}
}
public
static
function
listUserTypeStatus
(
$value
=
null
)
{
$values
=
[
self
::
ATIVO
=>
'Ativo'
,
self
::
INATIVO
=>
'Inativo'
,
];
return
$value
!==
null
?
$values
[
$value
]
:
$values
;
}
}
}
resources/views/components/alerts.blade.php
View file @
cbdb1f6b
...
@@ -22,3 +22,10 @@
...
@@ -22,3 +22,10 @@
<
button
type
=
"button"
class
=
"btn-close"
data
-
bs
-
dismiss
=
"alert"
aria
-
label
=
"Close"
></
button
>
<
button
type
=
"button"
class
=
"btn-close"
data
-
bs
-
dismiss
=
"alert"
aria
-
label
=
"Close"
></
button
>
</
div
>
</
div
>
@
endif
@
endif
@
if
(
Session
::
has
(
'warning'
)
)
<
div
class
=
"alert alert-warning alert-dismissible fade show"
role
=
"alert"
>
{{
Session
::
get
(
'warning'
)
}}
<
button
type
=
"button"
class
=
"btn-close"
data
-
bs
-
dismiss
=
"alert"
aria
-
label
=
"Close"
></
button
>
</
div
>
@
endif
\ No newline at end of file
resources/views/components/buttons/btn-cancel.blade.php
View file @
cbdb1f6b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
])
])
--
}}
--
}}
<
a
class
=
"btn btn-
secondary
"
href
=
"{{
$route
}}"
>
<
a
class
=
"btn btn-
danger
"
href
=
"{{
$route
}}"
>
<
i
class
=
"bi bi-x-circle"
></
i
>
<
i
class
=
"bi bi-x-circle"
></
i
>
{{
$content
}}
{{
$content
}}
</
a
>
</
a
>
resources/views/components/buttons/btn-close_modal.blade.php
View file @
cbdb1f6b
{{
--
{{
--
@
include
(
'components.buttons.btn-close_modal'
)
@
include
(
'components.buttons.btn-close_modal'
)
--
}}
--
}}
<
button
type
=
"button"
class
=
"btn btn-secondary"
data
-
bs
-
dismiss
=
"modal"
>
<
button
type
=
"button"
class
=
"btn btn-danger"
data
-
bs
-
dismiss
=
"modal"
>
<
i
class
=
"bi bi-x-circle"
></
i
>
Cancelar
Cancelar
</
button
>
</
button
>
\ No newline at end of file
resources/views/components/buttons/btn-delete.blade.php
View file @
cbdb1f6b
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
Você
tem
certeza
que
deseja
excluir
esse
item
?
Você
tem
certeza
que
deseja
excluir
esse
item
?
</
div
>
</
div
>
<
div
class
=
"modal-footer"
>
<
div
class
=
"modal-footer"
>
@
include
(
'components.buttons.btn-close_modal'
)
<
form
action
=
"{{
$route
}}"
method
=
"post"
>
<
form
action
=
"{{
$route
}}"
method
=
"post"
>
@
method
(
'DELETE'
)
@
method
(
'DELETE'
)
@
csrf
@
csrf
...
@@ -34,6 +33,7 @@
...
@@ -34,6 +33,7 @@
'content'
=>
'Excluir'
,
'content'
=>
'Excluir'
,
])
])
</
form
>
</
form
>
@
include
(
'components.buttons.btn-close_modal'
)
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
resources/views/components/modal.blade.php
View file @
cbdb1f6b
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
}
}
if
(
!
isset
(
$header
))
{
if
(
!
isset
(
$header
))
{
$header
=
'
Modal
'
;
$header
=
''
;
}
}
if
(
!
isset
(
$title
))
{
if
(
!
isset
(
$title
))
{
...
...
resources/views/pad/admin/create.blade.php
View file @
cbdb1f6b
...
@@ -10,76 +10,92 @@
...
@@ -10,76 +10,92 @@
@
include
(
'layouts.navigation'
,
[])
@
include
(
'layouts.navigation'
,
[])
@
endsection
@
endsection
@
section
(
'body'
)
@
section
(
'body'
)
<
div
class
=
""
>
<
div
class
=
"mb-3"
>
<
div
class
=
"mb-3"
>
<
h
2
class
=
"h
3
"
>
Pad
-
Criar
</
h
2
>
<
h
3
class
=
"h
4
"
>
PAD
-
Novo
</
h
3
>
</
div
>
</
div
>
<
form
class
=
"form"
action
=
"
{
{route('pad_store')}
}
"
method
=
"post"
>
<!--
Tabs
-->
@
csrf
<
div
>
<
div
class
=
"row mb-3"
>
<
ul
class
=
"nav nav-tabs"
>
<
div
class
=
"col"
>
<
li
class
=
"nav-item"
role
=
"presentation"
>
<
label
class
=
"form-label"
for
=
"nome"
>
Nome
</
label
>
<
button
class
=
"nav-link active"
id
=
"pad-tab"
data
-
bs
-
toggle
=
"tab"
data
-
bs
-
target
=
"#pad-container"
type
=
"button"
role
=
"tab"
aria
-
controls
=
"pad-container"
arial
-
selected
=
"true"
>
PAD
</
button
>
<
input
class
=
"form-control @error('nome') is-invalid @enderror"
type
=
"text"
name
=
"nome"
id
=
"nome"
value
=
"{{ old('nome') }}"
>
</
li
>
@
error
(
'nome'
)
</
ul
>
<
div
class
=
"alert alert-danger"
>
</
div
>
<
span
>
{{
$message
}}
</
span
>
<!--
Panels
-->
<
div
id
=
"tab-containers"
class
=
"tab-content"
>
<
div
id
=
"pad-container"
class
=
"tab-pane fade show active"
role
=
"tabpanel"
aria
-
labelledby
=
"pad-tab"
>
<
div
class
=
"mt-2 px-2"
>
<
form
class
=
"form"
action
=
"
{
{route('pad_store')}
}
"
method
=
"post"
>
@
csrf
<
div
class
=
"row mb-3"
>
<
div
class
=
"col"
>
<
label
class
=
"form-label"
for
=
"nome"
>
Nome
</
label
>
<
input
class
=
"form-control @error('nome') is-invalid @enderror"
type
=
"text"
name
=
"nome"
id
=
"nome"
value
=
"{{ old('nome') }}"
>
@
error
(
'nome'
)
<
div
class
=
"alert alert-danger"
>
<
span
>
{{
$message
}}
</
span
>
</
div
>
@
enderror
</
div
>
</
div
>
@
enderror
</
div
>
<
div
class
=
"col"
>
<
div
class
=
"col"
>
<
label
class
=
"form-label"
for
=
"status"
>
Status
</
label
>
<
label
class
=
"form-label"
for
=
"status"
>
Status
</
label
>
<
select
class
=
"form-select @error('status') is-invalid @enderror"
name
=
"status"
id
=
"status"
>
<
select
class
=
"form-select @error('status') is-invalid @enderror"
name
=
"status"
id
=
"status"
>
@
foreach
(
$status
as
$value
=>
$content
)
@
foreach
(
$status
as
$value
=>
$content
)
<
option
value
=
"
{
{$value}}">{{$content}
}
</option>
<
option
value
=
"
{
{$value}}">{{$content}
}
</option>
@endforeach
@endforeach
</select>
</select>
@error('status')
@error('status')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
</div>
</div>
<div class="
row
mb
-
3
">
<div class="
row
mb
-
3
">
<div class="
col
-
sm
-
6
">
<div class="
col
-
sm
-
6
">
<label class="
form
-
label
" for="
data_inicio
">Data de Início</label>
<label class="
form
-
label
" for="
data_inicio
">Data de Início</label>
<input class="
form
-
control
@
error
(
'data_inicio'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_inicio
" id="
data_inicio
" value="
{{
old
(
'data_inicio'
)
}}
">
<input class="
form
-
control
@
error
(
'data_inicio'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_inicio
" id="
data_inicio
" value="
{{
old
(
'data_inicio'
)
}}
">
@error('data_inicio')
@error('data_inicio')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
<div class="
col
-
sm
-
6
">
<div class="
col
-
sm
-
6
">
<label class="
form
-
label
" for="
data_fim
">Data de Fim</label>
<label class="
form
-
label
" for="
data_fim
">Data de Fim</label>
<input class="
form
-
control
@
error
(
'data_fim'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_fim
" id="
data_fim
" value="
{{
old
(
'data_fim'
)
}}
">
<input class="
form
-
control
@
error
(
'data_fim'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_fim
" id="
data_fim
" value="
{{
old
(
'data_fim'
)
}}
">
@error('data_fim')
@error('data_fim')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
</div>
</div>
<div class="
mt
-
1
text
-
end
">
<div class="
mt
-
1
text
-
end
">
@include('components.buttons.btn-cancel', [
@include('components.buttons.btn-cancel', [
'route' => route('pad_index'),
'route' => route('pad_index'),
'content' => 'Cancelar'
'content' => 'Cancelar'
])
])
@include('components.buttons.btn-save', [
@include('components.buttons.btn-save', [
'btn_class' => 'btn btn-outline-success',
'btn_class' => 'btn btn-outline-success',
'content' => 'Cadastrar',
'content' => 'Cadastrar',
])
])
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@endsection
resources/views/pad/admin/edit.blade.php
View file @
cbdb1f6b
...
@@ -10,76 +10,145 @@
...
@@ -10,76 +10,145 @@
@
include
(
'layouts.navigation'
,
[])
@
include
(
'layouts.navigation'
,
[])
@
endsection
@
endsection
@
section
(
'body'
)
@
section
(
'body'
)
<
div
class
=
""
>
<
div
class
=
"mb-3"
>
@
include
(
'components.alerts'
)
<
h2
class
=
"h3"
>
Pad
-
Atualizar
</
h2
>
</
div
>
<
div
class
=
"mb-3"
>
<
h3
class
=
"h4"
>
PAD
-
Atualizar
</
h3
>
</
div
>
<!--
Tabs
-->
<
div
>
<
ul
class
=
"nav nav-tabs"
>
<
li
class
=
"nav-item"
role
=
"presentation"
>
<
button
class
=
"nav-link active"
id
=
"pad-tab"
data
-
bs
-
toggle
=
"tab"
data
-
bs
-
target
=
"#pad-container"
type
=
"button"
role
=
"tab"
aria
-
controls
=
"pad-container"
arial
-
selected
=
"true"
>
PAD
</
button
>
</
li
>
<
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
>
</
li
>
</
ul
>
</
div
>
<!--
Panels
-->
<
div
id
=
"tab-containers"
class
=
"tab-content"
>
<
form
class
=
"form"
action
=
"{{route('pad_update', ['id' =>
$pad->id
])}}"
method
=
"post"
>
<
div
id
=
"pad-container"
class
=
"tab-pane fade show active"
role
=
"tabpanel"
aria
-
labelledby
=
"pad-tab"
>
@
csrf
<
div
class
=
"mt-2 px-2"
>
@
method
(
'PUT'
)
<
div
class
=
"row mb-3"
>
<
form
class
=
"form"
action
=
"{{route('pad_update', ['id' =>
$pad->id
])}}"
method
=
"post"
>
<
div
class
=
"col"
>
@
csrf
<
label
class
=
"form-label"
for
=
"nome"
>
Nome
</
label
>
@
method
(
'PUT'
)
<
input
class
=
"form-control @error('nome') is-invalid @enderror"
type
=
"text"
name
=
"nome"
id
=
"nome"
value
=
"{{
$pad->nome
}}"
>
<
div
class
=
"row mb-3"
>
@
error
(
'nome'
)
<
div
class
=
"col"
>
<
div
class
=
"alert alert-danger"
>
<
label
class
=
"form-label"
for
=
"nome"
>
Nome
</
label
>
<
span
>
{{
$message
}}
</
span
>
<
input
class
=
"form-control @error('nome') is-invalid @enderror"
type
=
"text"
name
=
"nome"
id
=
"nome"
value
=
"{{
$pad->nome
}}"
>
@
error
(
'nome'
)
<
div
class
=
"alert alert-danger"
>
<
span
>
{{
$message
}}
</
span
>
</
div
>
@
enderror
</
div
>
</
div
>
@
enderror
</
div
>
<
div
class
=
"col"
>
<
div
class
=
"col"
>
<
label
class
=
"form-label"
for
=
"status"
>
Status
</
label
>
<
label
class
=
"form-label"
for
=
"status"
>
Status
</
label
>
<
select
class
=
"form-select @error('status') is-invalid @enderror"
name
=
"status"
id
=
"status"
>
<
select
class
=
"form-select @error('status') is-invalid @enderror"
name
=
"status"
id
=
"status"
>
@
foreach
(
$status
as
$value
=>
$content
)
@
foreach
(
$status
as
$value
=>
$content
)
<
option
value
=
"
{
{$value}}">{{$content}
}
</option>
<
option
value
=
"
{
{$value}}">{{$content}
}
</option>
@endforeach
@endforeach
</select>
</select>
@error('status')
@error('status')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
</div>
</div>
<div class="
row
mb
-
3
">
<div class="
row
mb
-
3
">
<div class="
col
-
sm
-
6
">
<div class="
col
-
sm
-
6
">
<label class="
form
-
label
" for="
data_inicio
">Data de Início</label>
<label class="
form
-
label
" for="
data_inicio
">Data de Início</label>
<input class="
form
-
control
@
error
(
'data_inicio'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_inicio
" id="
data_inicio
" value="
{{
$pad
->
data_inicio
}}
">
<input class="
form
-
control
@
error
(
'data_inicio'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_inicio
" id="
data_inicio
" value="
{{
$pad
->
data_inicio
}}
">
@error('data_inicio')
@error('data_inicio')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
<div class="
col
-
sm
-
6
">
<div class="
col
-
sm
-
6
">
<label class="
form
-
label
" for="
data_fim
">Data de Fim</label>
<label class="
form
-
label
" for="
data_fim
">Data de Fim</label>
<input class="
form
-
control
@
error
(
'data_fim'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_fim
" id="
data_fim
" value="
{{
$pad
->
data_fim
}}
">
<input class="
form
-
control
@
error
(
'data_fim'
)
is
-
invalid
@
enderror
" type="
date
" name="
data_fim
" id="
data_fim
" value="
{{
$pad
->
data_fim
}}
">
@error('data_fim')
@error('data_fim')
<div class="
alert
alert
-
danger
">
<div class="
alert
alert
-
danger
">
<span>
{
{$message}
}
</span>
<span>
{
{$message}
}
</span>
</div>
@enderror
</div>
</div>
@enderror
</div>
</div>
<div class="
mt
-
4
text
-
end
">
@include('components.buttons.btn-save', [
'btn_class' => 'btn btn-outline-success',
'content' => 'Atualizar',
])
@include('components.buttons.btn-cancel', [
'route' => route('pad_index'),
'content' => 'Cancelar'
])
</div>
</form>
</div>
</div>
</div>
<div id="
user_pad
-
container
" class="
tab
-
pane
fade
" role="
tabpanel
" aria-labelledby="
user_pad
-
tab
">
<div class="
border
rounded
px
-
2
">
<div class="
mt
-
1
text
-
end
">
<div class="
text
-
end
my
-
2
">
@include('components.buttons.btn-cancel', [
<button type="
button
" class="
btn
btn
-
success
user
-
pad
-
create
"> Cadastrar Professor </button>
'route' => route('pad_index'),
</div>
'content' => 'Cancelar'
])
<table id="
user_pad
-
table
" class="
table
table
-
hover
">
<thead>
<tr>
<th scope="
col
"> Professor </th>
<th scope="
col
"> PAD </th>
<th scope="
col
"> C.H </th>
<th scope="
col
"> Opções </th>
</tr>
</thead>
<tbody>
@foreach(
$userPads
as
$userPad
)
<tr>
<td>{{
$userPad->user
}}</td>
<td>{{
$userPad->pad
->nome }}</td>
<td> <span class="
badge
bg
-
primary
">{{
$userPad->totalHoras
() }}</span> </td>
</tr>
@endforeach
</tbody>
</table>
@include('components.buttons.btn-save', [
'btn_class' => 'btn btn-outline-success',
'content' => 'Atualizar',
])
</div>
</div>
</form>
</div>
</div>
</div>
@include('components.modal', ['size' => 'modal-lg'])
@endsection
@endsection
@section('scripts')
@include('pad.components.scripts.dimensao.ensino.show_modal', [
'modal_id' => 'modal',
'route' => route('user-pad_create', ['pad_id' =>
$pad->id
]),
'btn_class' => 'user-pad-create',
])
@endsection
\ No newline at end of file
resources/views/user-pad/_form.blade.php
0 → 100644
View file @
cbdb1f6b
@
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/user-pad/create.blade.php
0 → 100644
View file @
cbdb1f6b
<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/user-pad/update.blade.php
0 → 100644
View file @
cbdb1f6b
resources/views/user-type/_form.blade.php
0 → 100644
View file @
cbdb1f6b
@
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
=
"user_id"
id
=
"user_id"
value
=
"{{
$user->id
}}"
>
<
div
class
=
"mb-3 col-sm-12"
>
<
label
class
=
"form-label"
for
=
"user_name"
>
Usuário
</
label
>
<
input
class
=
"form-control"
type
=
"text"
disabled
value
=
"{{
$user->name
}}"
>
</
div
>
<
div
class
=
"mb-3 col-sm-6"
>
<
label
class
=
"form-label"
for
=
"type"
>
Papel
</
label
>
<
select
class
=
"form-select @error('papel') is-invalid @enderror ajax-errors"
name
=
"type"
id
=
"type"
>
<
option
value
=
"0"
>
Selecione
um
Papel
</
option
>
@
foreach
(
$types
as
$value
=>
$type
)
@
if
(
$value
==
$model
->
type
)
<
option
selected
value
=
"
{
{$value}}">{{$type}
}
</option>
@else
<option value="
{{
$value
}}
">
{
{$type}
}
</option>
@endif
@endforeach
</select>
@include('components.divs.errors', [
'field' => field_validate('type')
])
</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>
Prev
1
2
Next
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