Unverified Commit ad863605 authored by Alisson Albuquerque's avatar Alisson Albuquerque Committed by GitHub
Browse files

Merge pull request #14 from alissonalbuquerque/fix_calendar_loading

Correção de Renderização de Calendário
parents 7bf03170 a7031949
......@@ -129,7 +129,7 @@ class TaskTime extends Model
public function tarefa()
{
// Return Ensino Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_ENSINO_ATENDIMENTO_DISCENTE) {
return $this->hasOne(EnsinoAtendimentoDiscente::class, 'id', 'tarefa_id');
}
......@@ -165,10 +165,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_ENSINO_SUPERVISAO) {
return $this->hasOne(EnsinoSupervisao::class, 'id', 'tarefa_id');
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Pesquisa Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_PESQUISA_COORDENACAO) {
return $this->hasOne(PesquisaCoordenacao::class, 'id', 'tarefa_id');
}
......@@ -184,10 +184,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_PESQUISA_OUTROS) {
return $this->hasOne(PesquisaOutros::class, 'id', 'tarefa_id');
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Extensao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_EXTENSAO_COORDENACAO) {
return $this->hasOne(ExtensaoCoordenacao::class, 'id', 'tarefa_id');
}
......@@ -199,10 +199,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_EXTENSAO_OUTROS) {
return $this->hasOne(ExtensaoOutros::class, 'id', 'tarefa_id');
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Gestao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_GESTAO_COORDENACAO_LABORATORIOS_DIDATICOS) {
return $this->hasOne(GestaoCoordenacaoLaboratoriosDidaticos::class, 'id', 'tarefa_id');
}
......@@ -234,7 +234,7 @@ class TaskTime extends Model
if($this->type == self::TYPE_GESTAO_REPRESENTANTE_UNIDADE_EDUCACAO) {
return $this->hasOne(GestaoRepresentanteUnidadeEducacao::class, 'id', 'tarefa_id');
}
// - - - - - - - - - -
// - - - - - - - - - -
}
public function userPad() {
......@@ -253,7 +253,7 @@ class TaskTime extends Model
*/
public function getName() {
// Return Ensino Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_ENSINO_ATENDIMENTO_DISCENTE) {
return $this->tarefa->componente_curricular;
}
......@@ -289,10 +289,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_ENSINO_SUPERVISAO) {
return $this->tarefa->atividade;
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Pesquisa Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_PESQUISA_COORDENACAO) {
return $this->tarefa->titulo_projeto;
}
......@@ -308,10 +308,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_PESQUISA_OUTROS) {
return $this->tarefa->atividade;
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Extensao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_EXTENSAO_COORDENACAO) {
return $this->tarefa->titulo_projeto;
}
......@@ -323,10 +323,10 @@ class TaskTime extends Model
if($this->type == self::TYPE_EXTENSAO_OUTROS) {
return $this->tarefa->atividade;
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Gestao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($this->type == self::TYPE_GESTAO_COORDENACAO_LABORATORIOS_DIDATICOS) {
return $this->tarefa->nome;
}
......@@ -358,7 +358,7 @@ class TaskTime extends Model
if($this->type == self::TYPE_GESTAO_REPRESENTANTE_UNIDADE_EDUCACAO) {
return $this->tarefa->nome;
}
// - - - - - - - - - -
// - - - - - - - - - -
}
/**
......@@ -374,7 +374,7 @@ class TaskTime extends Model
public function intervalTime($format = 'H:i:s') {
$startTime = DateTime::createFromFormat('H:i:s', $this->start_time);
$endTime = DateTime::createFromFormat('H:i:s', $this->end_time);
$interval = $startTime->diff($endTime);
......@@ -427,7 +427,7 @@ class TaskTime extends Model
public static function listTaskTypes($value = null) {
$values = [
self::TYPE_ENSINO_AULA => '',
self::TYPE_ENSINO_COORDENACAO_REGENCIA => '',
self::TYPE_ENSINO_ORIENTACAO => '',
......@@ -460,8 +460,8 @@ class TaskTime extends Model
return $value != null ? $values[$value] : $values;
}
/**
* @param $floatValue
/**
* @param $floatValue
* @return string|time
*/
public static function float_to_date_interval($float_value)
......@@ -475,15 +475,15 @@ class TaskTime extends Model
// Calcula os segundos
$segundos = round(($minutos_decimal - $minutos) * 60);
/** @var DateInterval */
$date_interval = new DateInterval("PT{$horas}H{$minutos}M{$segundos}S");
return $date_interval;
}
/**
* @param $floatValue
/**
* @param $floatValue
* @return string|time
*/
public static function convertFloatToHour($float_value)
......@@ -497,7 +497,7 @@ class TaskTime extends Model
// Calcula os segundos
$segundos = round(($minutos_decimal - $minutos) * 60);
/** @var DateInterval */
$date_interval = new DateInterval("PT{$horas}H{$minutos}M{$segundos}S");
......@@ -532,7 +532,7 @@ class TaskTime extends Model
return $hour;
}
/**
/**
* @param $taskTimes
* @return DateTime
*/
......@@ -543,7 +543,7 @@ class TaskTime extends Model
foreach($taskTimes as $taskTime) {
$split_time = explode(":", $taskTime->intervalTime());
$hours = $split_time[0];
$minutes = $split_time[1];
$seconds = $split_time[2];
......@@ -554,7 +554,7 @@ class TaskTime extends Model
return $sumDateTime;
}
/**
/**
* @param $taskTimes
* @return DateTime
*/
......@@ -584,10 +584,10 @@ class TaskTime extends Model
public static function date_interval_to_minutes(DateInterval $date_interval) {
[$days_to_minutes, $hours_to_minutes, $minutes] = [($date_interval->d * 24 * 60), ($date_interval->h * 60), ($date_interval->i * 1)];
return $days_to_minutes + $hours_to_minutes + $minutes;
}
/**
/**
* @param DateTime $dateTimeX
* @param DateTime $dateTimeY
* @return DateTime
......@@ -600,13 +600,13 @@ class TaskTime extends Model
$newDateTime = new DateTime($time_x);
$split_time = explode(":", $time_y);
$hours = $split_time[0];
$minutes = $split_time[1];
$seconds = $split_time[2];
$newDateTime->modify("+{$hours} hours +{$minutes} minutes +{$seconds} seconds");
return $newDateTime;
}
......@@ -614,7 +614,7 @@ class TaskTime extends Model
public static function tarefaByStatic($type, $tarefa_id)
{
// Return Ensino Models
// - - - - - - - - - -
// - - - - - - - - - -
if($type == self::TYPE_ENSINO_ATENDIMENTO_DISCENTE) {
return EnsinoAtendimentoDiscente::find($tarefa_id);
}
......@@ -650,10 +650,10 @@ class TaskTime extends Model
if($type == self::TYPE_ENSINO_SUPERVISAO) {
return EnsinoSupervisao::find($tarefa_id);
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Pesquisa Models
// - - - - - - - - - -
// - - - - - - - - - -
if($type == self::TYPE_PESQUISA_COORDENACAO) {
return PesquisaCoordenacao::find($tarefa_id);
}
......@@ -669,10 +669,10 @@ class TaskTime extends Model
if($type == self::TYPE_PESQUISA_OUTROS) {
return PesquisaOutros::find($tarefa_id);
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Extensao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($type == self::TYPE_EXTENSAO_COORDENACAO) {
return ExtensaoCoordenacao::find($tarefa_id);
}
......@@ -684,10 +684,10 @@ class TaskTime extends Model
if($type == self::TYPE_EXTENSAO_OUTROS) {
return ExtensaoOutros::find($tarefa_id);
}
// - - - - - - - - - -
// - - - - - - - - - -
// Return Gestao Models
// - - - - - - - - - -
// - - - - - - - - - -
if($type == self::TYPE_GESTAO_COORDENACAO_LABORATORIOS_DIDATICOS) {
return GestaoCoordenacaoLaboratoriosDidaticos::find($tarefa_id);
}
......@@ -719,6 +719,6 @@ class TaskTime extends Model
if($type == self::TYPE_GESTAO_REPRESENTANTE_UNIDADE_EDUCACAO) {
return GestaoRepresentanteUnidadeEducacao::find($tarefa_id);
}
// - - - - - - - - - -
// - - - - - - - - - -
}
}
......@@ -6,7 +6,6 @@
@csrf
@method('POST')
<div class="row">
<input type="hidden" id="user_pad_id" name="user_pad_id" value="{{ $user_pad_id }}">
......@@ -16,77 +15,90 @@
<input type="hidden" id="id" name="id" value="">
<div class="mb-4 col-sm-2">
<div class="">
<label class="form-label" for="cod_atividade">Cód. Atividade</label>
<input class="form-control @error('cod_atividade') is-invalid @enderror ajax-errors" type="text" name="cod_atividade" id="cod_atividade" readonly>
</div>
@include('components.divs.errors', [
'field' => 'cod_atividade_create'
])
</div>
<div class="row">
<div class="col-sm-10">
<div class="mt-3">
<label for="weekday">Dia da Semana</label>
<select name="weekday" id="weekday" class="form-select @error('weekday') is-invalid @enderror ajax-errors">
@foreach(TaskTime::listWeekDays() as $id => $text)
<option value="{{$id}}">{{$text}}</option>
@endforeach
</select>
<div class="mb-4 col-sm-2">
<div class="">
<label class="form-label" for="cod_atividade">Cód. Atividade</label>
<input class="form-control @error('cod_atividade') is-invalid @enderror ajax-errors" type="text" name="cod_atividade" id="cod_atividade" readonly>
</div>
@include('components.divs.errors', [
'field' => 'weekday_create'
'field' => 'cod_atividade_create'
])
</div>
</div>
<div class="col-sm-12">
<div class="">
<label for="slct_tarefa_id">Atividade</label>
<select name="slct_tarefa_id" id="slct_tarefa_id" class="form-select @error('slct_tarefa_id') is-invalid @enderror ajax-errors">
</select>
<div class="col-sm-10">
<div class="">
<label class="mb-2" for="weekday">Dia da Semana</label>
<select name="weekday" id="weekday" class="form-select @error('weekday') is-invalid @enderror ajax-errors">
@foreach(TaskTime::listWeekDays() as $id => $text)
<option value="{{$id}}">{{$text}}</option>
@endforeach
</select>
@include('components.divs.errors', [
'field' => 'weekday_create'
])
</div>
</div>
@include('components.divs.errors', [
'field' => 'slct_tarefa_id_create'
])
</div>
<div class="col-sm-6">
<div class="mt-3">
<label class="form-label" for="start_time">Horário Inicial</label>
<input type="time" min="07:30" max="21:15" name="start_time" id="start_time" class="form-control @error('start_time') is-invalid @enderror ajax-errors" >
<div class="row">
<div class="col-md-12">
<div class="">
<label for="slct_tarefa_id">Atividade</label>
<select name="slct_tarefa_id" id="slct_tarefa_id" class="form-select @error('slct_tarefa_id') is-invalid @enderror ajax-errors">
</select>
</div>
@include('components.divs.errors', [
'field' => 'start_time_create',
'field' => 'slct_tarefa_id_create'
])
</div>
</div>
<div class="col-sm-6">
<div class="mt-3">
<label class="form-label" for="end_time">Horário Final</label>
<input type="time" min="07:30" max="21:15" name="end_time" id="end_time" class="form-control @error('end_time') is-invalid @enderror ajax-errors" >
@include('components.divs.errors', [
'field' => 'end_time_create',
])
<div class="row">
<div class="col-sm-6">
<div class="mt-3">
<label class="form-label" for="start_time">Horário Inicial</label>
<input type="time" min="07:30" max="21:15" name="start_time" id="start_time" class="form-control @error('start_time') is-invalid @enderror ajax-errors" >
@include('components.divs.errors', [
'field' => 'start_time_create',
])
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="mt-3">
<label class="form-label" for="end_time">Horário Final</label>
<input type="time" min="07:30" max="21:15" name="end_time" id="end_time" class="form-control @error('end_time') is-invalid @enderror ajax-errors">
<div class="mt-1 text-end">
<div class="modal-footer">
@include('components.buttons.btn-save', [
'id' => 'btn_submit',
'content' => 'Cadastrar',
])
@include('components.divs.errors', [
'field' => 'end_time_create',
])
</div>
</div>
@include('components.buttons.btn-close_modal')
</div>
<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>
</div>
</form>
......@@ -100,12 +112,12 @@
<script type="text/javascript">
$('#weekday').select2(
{
allowClear: true,
placeholder: 'Dia da Semana',
dropdownParent: $('#modal')
})
// $('#weekday').select2(
// {
// allowClear: true,
// placeholder: 'Dia da Semana',
// dropdownParent: $('#modal')
// })
$('#slct_tarefa_id').select2(
{
......@@ -164,7 +176,7 @@
error: (xhr, status, error) => {
console.error('Erro na requisição!');
}
});
});
}
})
......
......@@ -38,7 +38,12 @@
$weekColumn = TaskTime::whereUserPadId($user_pad_id)->whereWeekday($weekday)->orderBy('start_time', 'ASC')->get();
$weekColumns[$weekday] = $weekColumn->isNotEmpty() ? $weekColumn : collect(['--']);
$weekColumn =
$weekColumn->filter(function(TaskTIme $model) {
return $model->tarefa !== null;
});
$weekColumns[$weekday] = $weekColumn->isNotEmpty() ? $weekColumn : collect(['--']);
if(count($weekColumns[$weekday]) > $max_len_column) {
$max_len_column = count($weekColumns[$weekday]);
......
......@@ -15,15 +15,15 @@
@csrf
@method('POST')
<div class="row">
<input type="hidden" id="user_pad_id" name="user_pad_id" value="{{ $model->user_pad_id }}">
<input type="hidden" id="user_pad_id" name="user_pad_id" value="{{ $model->user_pad_id }}">
<input type="hidden" id="tarefa_id" name="tarefa_id" value="{{ $model->tarefa_id }}">
<input type="hidden" id="tarefa_id" name="tarefa_id" value="{{ $model->tarefa_id }}">
<input type="hidden" id="type" name="type" value="{{ $model->type }}">´
<input type="hidden" id="type" name="type" value="{{ $model->type }}">´
<input type="hidden" id="id" name="id" value="{{ $model->id }}">
<input type="hidden" id="id" name="id" value="{{ $model->id }}">
<div class="row">
<div class="mb-4 col-sm-2">
<div class="">
......@@ -37,8 +37,8 @@
</div>
<div class="col-sm-10">
<div class="mt-3">
<label for="weekday">Dia da Semana</label>
<div class="">
<label class="mb-2" for="weekday">Dia da Semana</label>
<select name="weekday" id="weekday" class="form-select @error('weekday') is-invalid @enderror ajax-errors">
@foreach(TaskTime::listWeekDays() as $id => $text)
@if( $model->weekday == $id)
......@@ -55,6 +55,9 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="">
<label for="slct_tarefa_id">Atividade</label>
......@@ -67,12 +70,15 @@
'field' => 'slct_tarefa_id'
])
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="mt-3">
<label class="form-label" for="start_time">Horário Inicial</label>
<input type="time" name="start_time" id="start_time" value="{{$model->start_time}}" class="form-control @error('start_time') is-invalid @enderror ajax-errors" >
@include('components.divs.errors', [
'field' => 'start_time_update',
])
......@@ -83,14 +89,15 @@
<div class="mt-3">
<label class="form-label" for="end_time">Horário Final</label>
<input type="time" name="end_time" id="end_time" value="{{$model->end_time}}" class="form-control @error('end_time') is-invalid @enderror ajax-errors" >
@include('components.divs.errors', [
'field' => 'end_time_update',
])
</div>
</div>
</div>
<div class="mt-4">
<div class="modal-footer">
<div class="text-start">
......@@ -121,12 +128,12 @@
<script type="text/javascript">
$('#weekday').select2(
{
allowClear: true,
placeholder: 'Dia da Semana',
dropdownParent: $('#modal')
})
// $('#weekday').select2(
// {
// allowClear: true,
// placeholder: 'Dia da Semana',
// dropdownParent: $('#modal')
// })
$('#slct_tarefa_id').select2(
{
......@@ -151,7 +158,7 @@
})
$('#slct_tarefa_id').on('change', function(e)
{
{
const type = $('#type')
const tarefa_id = $('#tarefa_id')
......@@ -185,7 +192,7 @@
error: (xhr, status, error) => {
console.error('Erro na requisição!');
}
});
});
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment