You are on page 1of 3

1/8/2020 Termina agregar UI campos nuevos tabla partakers (f25213be) · Commits · Guillermo Agudelo / apptalento · GitLab

Please ensure your account's recovery settings are up to date.

Commit f25213be authored 2 days ago by Guillermo Agudelo

Termina agregar UI campos nuevos tabla partakers

parent 373d24a5 master

No related merge requests found

Showing 5 changed files  with 227 additions and 70 deletions

  app/Http/Controllers/API/PartakerController.php
... ... @@ -12,9 +12,11 @@ class PartakerController extends Controller
12 12 public function getCarers(Request $request)
13 13 {
14 14 $param = $request->q ?? '';
15 - $data = Partaker::where('first_name', 'like', "%{$param}%")
16 - ->orWhere('last_name', 'like', "%{$param}%")
17 - ->where('pot_source_id', 3);
15 + $data = Partaker::where('pot_source_id', 3)
16 + ->where(function($query) use($param) {
17 + $query->where('last_name', 'like', "%{$param}%")
18 + ->orWhere('first_name', 'like', "%{$param}%");
19 + });
18 20
19 21 if (auth()->user()->isA(role('ADMIN'))) {
20 22 $data = $data->where('client_id', auth()->user()->client_id);
... ... @@ -26,9 +28,11 @@ class PartakerController extends Controller
26 28 public function getTeachers(Request $request)
27 29 {
28 30 $param = $request->q ?? '';
29 - $data = Partaker::where('first_name', 'like', "%{$param}%")
30 - ->orWhere('last_name', 'like', "%{$param}%")
31 - ->where('pot_source_id', 2);
31 + $data = Partaker::where('pot_source_id', 2)
32 + ->where(function($query) use($param) {
33 + $query->where('last_name', 'like', "%{$param}%")
34 + ->orWhere('first_name', 'like', "%{$param}%");
35 + });
32 36
33 37 if (auth()->user()->isA(role('ADMIN'))) {
34 38 $data = $data->where('client_id', auth()->user()->client_id);
... ...

  app/Models/Partaker.php

... ... @@ -38,6 +38,16 @@ class Partaker extends Model


38 38 return $this->belongsTo(Client::class);
39 39 }
40 40
41 + public function carer()
42 + {
43 + return $this->belongsTo(Partaker::class, 'carer_id');
44 + }
45 +
46 + public function teacher()
47 + {
48 + return $this->belongsTo(Partaker::class, 'teacher_id');
49 + }
50 +
41 51 public function identificationType()
42 52 {
43 53 return $this->belongsTo(IdentificationType::class);
... ...

  resources/views/admin/partakers/create blade php


https://gitlab.com/guille.agudelo/apptalento/-/commit/f25213be8a051a588cabc8d208f15575501c1bd7 1/3
1/8/2020 Termina agregar UI campos nuevos tabla partakers (f25213be) · Commits · Guillermo Agudelo / apptalento · GitLab
  resources/views/admin/partakers/create.blade.php
... ... @@ -220,7 +220,7 @@
220 220 </div>
221 221 </div>
222 222
223 - <template v-show="typeStudentSelected">
223 + <div :class="{'d-none': !typeStudentSelected}">
224 224 <h2>Responsables del estudiante</h2>
225 225 <div class="row mb-4 p-3 border rounded">
226 226 <div class="col-lg-6">
... ... @@ -255,7 +255,7 @@
255 255 </div>
256 256 </div>
257 257 </div>
258 - </template>
258 + </div>
259 259
260 260 <div class="my-4">
261 261 <a href="{{route('admin.partakers.index')}}" class="btn btn-secondary">
... ...

  resources/views/admin/partakers/edit.blade.php

This diff is collapsed.

  resources/views/admin/partakers/show.blade.php
... ... @@ -93,6 +93,35 @@
93 93 </div>
94 94 </div>
95 95
96 + @if($partaker->carer_id)
97 + <h2>Responsables del estudiante</h2>
98 + <div class="row mb-4 p-3 border rounded">
99 + <div class="col-lg-6">
100 + <div class="form-group">
101 + <label for="">Familiar/Cuidador</label>
102 + <h3>{{$partaker->carer->fullName}}</h3>
103 + <small>
104 + ({{$partaker->carer->identificationType->name}}
105 + {{$partaker->carer->identification}})
106 + </small>
107 + </div>
108 + </div>
109 +
110 + <div class="col-lg-6">
111 + <div class="form-group">
112 + <label for="">Docente</label>
113 + <h3>
114 + {{$partaker->teacher->fullName}}
115 + <small>
116 + ({{$partaker->teacher->identificationType->name}}
117 + {{$partaker->teacher->identification}})
118 + </small>
119 + </h3>
120 + </div>
121 + </div>
122 + </div>
123 + @endif
124 +
96 125
97 126 <div class="my-4">
98 127 <a href="javascript: history.go(-1)" class="btn btn-secondary">
... ...

Write a comment or drag your files here…

Markdown and quick actions are supported

https://gitlab.com/guille.agudelo/apptalento/-/commit/f25213be8a051a588cabc8d208f15575501c1bd7 2/3
1/8/2020 Termina agregar UI campos nuevos tabla partakers (f25213be) · Commits · Guillermo Agudelo / apptalento · GitLab

https://gitlab.com/guille.agudelo/apptalento/-/commit/f25213be8a051a588cabc8d208f15575501c1bd7 3/3

You might also like