Professional Documents
Culture Documents
app/Http/Controllers/Admin/PartakerController.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Http\Controllers\Admin;
4 +
5 + use App\Http\Controllers\Controller;
6 + use App\Models\Partaker;
7 + use Illuminate\Http\Request;
8 +
9 + class PartakerController extends Controller
10 +{
11 + public function index()
12 + {
13 + $partakers = Partaker::where('client_id', auth()->user()->client_id)->paginate(2);
14 + return view('admin.partakers.index', compact('partakers'));
15 + }
16 +
17 + public function show(Request $request, Partaker $partaker)
18 + {
19 + return view('admin.partakers.show', compact('partaker'));
20 + }
21 +}
app/Models/Grade.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Grade extends Model
8 +{
9 + //
10 +}
app/Models/Modality.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Modality extends Model
8 +{
9 + //
10 +}
app/Models/Partaker.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 1/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Partaker extends Model
8 +{
9 + protected $guarded = [];
10 +
11 + public function getFullNameAttribute()
12 + {
13 + return "{$this->first_name} {$this->last_name}";
14 + }
15 +
16 + public function source()
17 + {
18 + return $this->belongsTo(PotSource::class, 'pot_source_id');
19 + }
20 +
21 + public function modality()
22 + {
23 + return $this->belongsTo(Modality::class);
24 + }
25 +
26 + public function grade()
27 + {
28 + return $this->belongsTo(Grade::class);
29 + }
30 +
31 + public function session()
32 + {
33 + return $this->belongsTo(Session::class);
34 + }
35 +
36 + public function client()
37 + {
38 + return $this->belongsTo(Client::class);
39 + }
40 +
41 + public function identificationType()
42 + {
43 + return $this->belongsTo(IdentificationType::class);
44 + }
45 +}
app/Models/Session.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Session extends Model
8 +{
9 + //
10 +}
app/Support/Globals.php
... ... @@ -51,6 +51,18 @@ abstract class UserTypes
51 51 }
52 52 }
53 53
54 + abstract class PartakerTypes
55 +{
56 + const ESTUDIANTE = 'EstudiantE';
57 + const DOCENTE = 'Docente';
58 + const CUIDADOR = 'Cuidador';
59 +
60 + public static function getConstants() {
61 + $oClass = new ReflectionClass(__CLASS__);
62 + return array_values($oClass->getConstants());
63 + }
64 +}
65 +
54 66
55 67
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 2/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
56 68 if (!function_exists('role')) {
... ...
database/migrations/2020_07_28_160209_create_sessions_table.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Migrations\Migration;
4 + use Illuminate\Database\Schema\Blueprint;
5 + use Illuminate\Support\Facades\Schema;
6 +
7 + class CreateSessionsTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('sessions', function (Blueprint $table) {
17 + $table->id();
18 + $table->string('name');
19 + $table->timestamps();
20 + });
21 + }
22 +
23 + /**
24 + * Reverse the migrations.
25 + *
26 + * @return void
27 + */
28 + public function down()
29 + {
30 + Schema::dropIfExists('sessions');
31 + }
32 +}
database/migrations/2020_07_28_160231_create_modalities_table.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Migrations\Migration;
4 + use Illuminate\Database\Schema\Blueprint;
5 + use Illuminate\Support\Facades\Schema;
6 +
7 + class CreateModalitiesTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('modalities', function (Blueprint $table) {
17 + $table->id();
18 + $table->string('name');
19 + $table->timestamps();
20 + });
21 + }
22 +
23 + /**
24 + * Reverse the migrations.
25 + *
26 + * @return void
27 + */
28 + public function down()
29 + {
30 + Schema::dropIfExists('modalities');
31 + }
32 +}
database/migrations/2020_07_28_160242_create_grades_table.php 0 → 100644
1 + <?php
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 3/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
2 +
3 + use Illuminate\Database\Migrations\Migration;
4 + use Illuminate\Database\Schema\Blueprint;
5 + use Illuminate\Support\Facades\Schema;
6 +
7 + class CreateGradesTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('grades', function (Blueprint $table) {
17 + $table->id();
18 + $table->string('name');
19 + $table->timestamps();
20 + });
21 + }
22 +
23 + /**
24 + * Reverse the migrations.
25 + *
26 + * @return void
27 + */
28 + public function down()
29 + {
30 + Schema::dropIfExists('grades');
31 + }
32 +}
database/migrations/2020_07_28_160311_create_partakers_table.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Migrations\Migration;
4 + use Illuminate\Database\Schema\Blueprint;
5 + use Illuminate\Support\Facades\Schema;
6 +
7 + class CreatePartakersTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('partakers', function (Blueprint $table) {
17 + $table->id();
18 + $table->string('first_name');
19 + $table->string('last_name');
20 + $table->string('email');
21 + $table->foreignId('identification_type_id');
22 + $table->string('identification');
23 + $table->date('birthday')->nullable();
24 + $table->enum('sex', ['M', 'F'])->nullable();
25 + $table->string('phone')->nullable();
26 + $table->foreignId('modality_id')->nullable();
27 + $table->foreignId('session_id')->nullable();
28 + $table->foreignId('grade_id')->nullable();
29 + $table->foreignId('pot_source_id');
30 + $table->foreignId('client_id');
31 + $table->boolean('active')->default(true);
32 + $table->timestamps();
33 + });
34 + }
35 +
36 + /**
37 + * Reverse the migrations.
38 + *
39 + * @return void
40 + */
41 + public function down()
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 4/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
42 + {
43 + Schema::dropIfExists('partakers');
44 + }
45 +}
database/seeds/DatabaseSeeder.php
database/seeds/GradeSeeder.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Seeder;
4 +
5 + class GradeSeeder extends Seeder
6 +{
7 + /**
8 + * Run the database seeds.
9 + *
10 + * @return void
11 + */
12 + public function run()
13 + {
14 + DB::table('grades')->insert([
15 + ['name' => 'Primero'],
16 + ['name' => 'Segundo'],
17 + ['name' => 'Tercero'],
18 + ['name' => 'Cuarto'],
19 + ['name' => 'Quinto'],
20 + ]);
21 + }
22 +}
database/seeds/ModalitySeeder.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Seeder;
4 +
5 + class ModalitySeeder extends Seeder
6 +{
7 + /**
8 + * Run the database seeds.
9 + *
10 + * @return void
11 + */
12 + public function run()
13 + {
14 + DB::table('modalities')->insert([
15 + ['name' => 'Presencial'],
16 + ['name' => 'Semipresencial'],
17 + ['name' => 'Virtual'],
18 + ]);
19 + }
20 +}
database/seeds/PartakerSeeder.php 0 → 100644
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 5/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
1 + <?php
2 +
3 + use Illuminate\Database\Seeder;
4 +
5 + class PartakerSeeder extends Seeder
6 +{
7 + /**
8 + * Run the database seeds.
9 + *
10 + * @return void
11 + */
12 + public function run()
13 + {
14 + DB::table('partakers')->insert([
15 + // institucion maria gutierrez
16 + [
17 + 'first_name' => 'Sofia José',
18 + 'last_name' => 'Gutiérrez Torregrosa',
19 + 'email' => 'sofiag@gmail.com',
20 + 'identification_type_id' => 2, //TI
21 + 'identification' => '1129923847',
22 + 'birthday' => '2010-05-20',
23 + 'sex' => 'F',
24 + 'phone' => null,
25 + 'modality_id' => 1, //presencial
26 + 'session_id' => 1, //mañana
27 + 'grade_id' => 3, //tercero
28 + 'pot_source_id' => 1, //estudiante,
29 + 'client_id' => 2, //instituto maria g.
30 + 'active' => true,
31 + 'created_at' => now(),
32 + 'updated_at' => now(),
33 + ],
34 + [
35 + 'first_name' => 'Rolando José',
36 + 'last_name' => 'Pérez Rollevilla',
37 + 'email' => 'rolandog@gmail.com',
38 + 'identification_type_id' => 3, //CC
39 + 'identification' => '85022938',
40 + 'birthday' => null,
41 + 'sex' => 'M',
42 + 'phone' => '3049857623',
43 + 'modality_id' => null, //
44 + 'session_id' => null, //
45 + 'grade_id' => null, //
46 + 'pot_source_id' => 2, //docente
47 + 'client_id' => 2, //instituto maria g.
48 + 'active' => true,
49 + 'created_at' => now(),
50 + 'updated_at' => now(),
51 + ],
52 + [
53 + 'first_name' => 'Juliana Maria',
54 + 'last_name' => 'Torregrosa Pérez',
55 + 'email' => 'julianaq@gmail.com',
56 + 'identification_type_id' => 3, //CC
57 + 'identification' => '87022938',
58 + 'birthday' => null,
59 + 'sex' => 'F',
60 + 'phone' => '3019857623',
61 + 'modality_id' => null, //
62 + 'session_id' => null, //
63 + 'grade_id' => null, //
64 + 'pot_source_id' => 3, //familiar
65 + 'client_id' => 2, //instituto maria g.
66 + 'active' => true,
67 + 'created_at' => now(),
68 + 'updated_at' => now(),
69 + ],
70 +
71 +
72 + //plan personal, roberto bolaños
73 + [
74 + 'first_name' => 'Pedro José',
75 + 'last_name' => 'Jiménez Buitrago',
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 6/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
database/seeds/SessionSeeder.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Seeder;
4 +
5 + class SessionSeeder extends Seeder
6 +{
7 + /**
8 + * Run the database seeds.
9 + *
10 + * @return void
11 + */
12 + public function run()
13 + {
14 + DB::table('sessions')->insert([
15 + ['name' => 'Mañana'],
16 + ['name' => 'Tarde'],
17 + ['name' => 'Noche'],
18 + ]);
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 7/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
19 + }
20 +}
resources/views/admin/partakers/index.blade.php 0 → 100644
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 8/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
71 +
72 + </div>
73 + @endsection
resources/views/admin/partakers/show.blade.php 0 → 100644
1 + @extends('layouts.app', ['title' => 'Detalles del Participante: '.$partaker->name])
2 + @section('content')
3 + <div class="container mx-4" id="partakers">
4 +
5 + <h2>Información básica</h2>
6 + <div class="row mb-4 p-3 border rounded">
7 + <div class="col-lg-6">
8 + <div class="form-group">
9 + <label for="">Nombres</label>
10 + <h3>{{$partaker->first_name}}</h3>
11 + </div>
12 +
13 + <div class="form-group">
14 + <label for="">Apellidos</label>
15 + <h3>{{$partaker->last_name}}</h3>
16 + </div>
17 + </div>
18 +
19 + <div class="col-lg-6">
20 + <div class="form-group">
21 + <label for="">Tipo de Identificación</label>
22 + <h3>{{$partaker->identificationType->name}}</h3>
23 + </div>
24 +
25 + <div class="form-group">
26 + <label for="">Número de Identificación</label>
27 + <h3>{{$partaker->identification}}</h3>
28 + </div>
29 + </div>
30 + </div>
31 +
32 +
33 + <h2>Información complementaria</h2>
34 + <div class="row mb-4 p-3 border rounded">
35 + <div class="col-lg-6">
36 + <div class="form-group">
37 + <label for="">Email</label>
38 + <h3>{{$partaker->email}}</h3>
39 + </div>
40 +
41 + <div class="form-group">
42 + <label for="">Teléfono</label>
43 + <h3>{{$partaker->phone ?? '-'}}</h3>
44 + </div>
45 + </div>
46 +
47 + <div class="col-lg-6">
48 + <div class="form-group">
49 + <label for="">Fecha de nacimiento</label>
50 + <h3>{{$partaker->birthday ?? '-'}}</h3>
51 + </div>
52 +
53 + <div class="form-group">
54 + <label for="">Sexo</label>
55 + <h3>{{$partaker->sex ?? '-'}}</h3>
56 + </div>
57 + </div>
58 + </div>
59 +
60 +
61 + <h2>Información de la entidad</h2>
62 + <div class="row mb-4 p-3 border rounded">
63 + <div class="col-lg-6">
64 + <div class="form-group">
65 + <label for="">Tipo</label>
66 + <h3>{{$partaker->source->name}}</h3>
67 + </div>
68 +
69 + <div class="form-group">
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 9/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
70 + <label for="">Jornada</label>
71 + <h3>{{@$partaker->session->name ?? '-'}}</h3>
72 + </div>
73 +
74 + <div class="form-group">
75 + <label for="">Estado</label><br>
76 + @if($partaker->active)
77 + <span class="badge badge-lg badge-success">Activo</span>
78 + @else
79 + <span class="badge badge-lg badge-danger">Inactivo</span>
80 + @endif
81 + </div>
82 + </div>
83 +
84 + <div class="col-lg-6">
85 + <div class="form-group">
86 + <label for="">Grado</label>
87 + <h3>{{@$partaker->grade->name ?? '-'}}</h3>
88 + </div>
89 + <div class="form-group">
90 + <label for="">Modalidad</label>
91 + <h3>{{@$partaker->modality->name ?? '-'}}</h3>
92 + </div>
93 + </div>
94 + </div>
95 +
96 +
97 + <div class="my-4">
98 + <a href="javascript: history.go(-1)" class="btn btn-secondary">
99 + <i class="fa fa-arrow-left"></i> Volver
100 + </a>
101 + <a href="{{route('admin.partakers.edit', $partaker)}}" class="btn btn-info" type="submit">
102 + <i class="fa fa-edit"></i> Editar este usuario
103 + </a>
104 + </div>
105 +
106 +
107 + </div>
108 + @endsection
109 + @push('js')
110 + <script>
111 + $('#client_id').selectpicker('val', @json(old('client_id', $partaker->client_id)));
112 + </script>
113 + @endpush
resources/views/layouts/navbars/sidebar.blade.php
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 10/11
1/8/2020 Parcial CRUD Participantes (9e01fd02) · Commits · Guillermo Agudelo / apptalento · GitLab
131 139
132 140 </ul>
133 141 @endadminplus
... ...
routes/web.php
... ... @@ -116,6 +116,8 @@ Route::group([
116 116
117 117 });
118 118
119 + Route::resource('partakers', 'PartakerController');
120 +
119 121
120 122 });
121 123
... ...
https://gitlab.com/guille.agudelo/apptalento/-/commit/9e01fd0224695f12b91397f267139ee9a6bc113c 11/11