Вы находитесь на странице: 1из 4

29/6/2020 Muestra servicios en texto de label empleado (1fc49d3a) · Commits · Guillermo Agudelo / transito-frontend · GitLab

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

Commit 1fc49d3a authored 2 weeks ago by Guillermo Agudelo

Muestra servicios en texto de label empleado

parent 1a3881fd master

No related merge requests found

Showing 7 changed files  with 21 additions and 102 deletions

  app/Employee.php
... ... @@ -8,15 +8,18 @@ class Employee extends LarafireModel
8 8 {
9 9 protected $collectionName = 'employees';
10 10
11 - public function getOwnServicesLabels()
11 + public function getOwnServicesLabels(bool $returnAsArray)
12 12 {
13 13 $servicesEmployees = ServiceEmployee::whereGetInstances('idEmployee','=',$this->id());
14 14 $servicesIds = $servicesEmployees->map(fn($servEmp) => $servEmp->field('idService'))->all();
15 - // dd($servicesIds->all());
16 - // $services = Service::whereGetInstances('id', 'in', $servicesIds);
17 - $services = Service::whereGetInstances('key', '=', '0y0VLHntVPNvA3Bsw4Gt');
15 + $services = Service::whereIdIn($servicesIds);
18 16
17 + if ($returnAsArray) {
18 + return collect(array_map(function($service) {
19 + return $service->fields();
20 + }, $services->toArray()));
21 + }
19 22
20 - dd($services);
23 + return $services;
21 24 }
22 25 }

  app/Http/Controllers/AuthController.php
... ... @@ -54,7 +54,7 @@ class AuthController extends Controller
54 54 $employee = Employee::first('uid', '=', \LfAuth::id());
55 55 $company = Company::find($employee->field('idCompany'));
56 56 $branch = Branch::find($employee->field('idBranch'));
57 - $employeeServices = $employee->getOwnServicesLabels();
57 + $employeeServices = $employee->getOwnServicesLabels(true);
58 58
59 59 $state = [
60 60 'employee' => $employee->fields(),
... ...

  app/Support/LarafireCollection.php deleted 100644 → 0

1 - <?php
2 -
3 - namespace App\Support;
4 -
5 - use Iterator;
6 -
7 - class LarafireCollection implements Iterator
8 -{
9 - private $position = 0;
10 - private $items;
11 -
12 - public function __construct() {
13 - $this->position = 0;
14 - }
https://gitlab.com/guille.agudelo/transito-frontend/-/commit/1fc49d3af1d481c73e58f2711c806b94bc706e4c 1/4
29/6/2020 Muestra servicios en texto de label empleado (1fc49d3a) · Commits · Guillermo Agudelo / transito-frontend · GitLab

15 -
16 -
17 - // STATIC METHODS
18 -
19 - private static function getNewInstance()
20 - {
21 - $className = get_class();
22 - return new $className;
23 - }
24 -
25 - public static function collect(array $array)
26 - {
27 - $instance = self::getNewInstance();
28 - $instance->setItems($array);
29 - return $instance;
30 - }
31 -
32 - public function setItems(array $items)
33 - {
34 - $this->items = $items;
35 - }
36 -
37 - public function all()
38 - {
39 - return $this->items;
40 - }
41 -
42 - public function toArray()
43 - {
44 - return array_map(function($item) {
45 - return $item->toArray();
46 - }, $this->items);
47 - }
48 -
49 -
50 -
51 -
52 -
53 -
54 - // ITERATOR METHODS
55 -
56 - public function rewind() {
57 - $this->position = 0;
58 - }
59 -
60 - public function current() {
61 - return $this->items[$this->position];
62 - }
63 -
64 - public function key() {
65 - return $this->position;
66 - }
67 -
68 - public function next() {
69 - ++$this->position;
70 - }
71 -
72 - public function valid() {
73 - return isset($this->items[$this->position]);
74 - }
75 -
76 -}

  app/Support/LarafireModel.php

... ... @@ -73,15 +73,7 @@ class LarafireModel implements JsonSerializable


73 73 {
74 74 $instance = self::getNewInstance();
75 75
76 - if ($field == 'id') {
77 - switch ($operation) {
78 - case 'in':
79 - // foreach ($value as ) //TODO: Terminar esta vuelta
80 - }
81 - }

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/1fc49d3af1d481c73e58f2711c806b94bc706e4c 2/4
29/6/2020 Muestra servicios en texto de label empleado (1fc49d3a) · Commits · Guillermo Agudelo / transito-frontend · GitLab

82 -
83 76 return $instance->collection->where($field, $operation, $value);
84 -
85 77 }
86 78
87 79 public static function whereGetInstances($field, $operation, $value)
... ... @@ -91,6 +83,15 @@ class LarafireModel implements JsonSerializable
91 83 return self::rowsToInstances($rows);
92 84 }
93 85
86 + public static function whereIdIn(array $ids)
87 + {
88 + $instance = self::getNewInstance();
89 +
90 + return collect(array_map(function($id) use ($instance) {
91 + return $instance->find($id);
92 + }, $ids));
93 + }
94 +
94 95 public static function first($field, $operation, $value)
95 96 {
96 97 $instance = self::getNewInstance();
... ...

  composer.json

... ... @@ -48,8 +48,6 @@


48 48 ],
49 49 "files": [
50 50 "app/Support/LarafireAuth.php",
51 - "app/Support/LarafireCollection.php",
52 - "app/Support/LarafireFunctions.php",
53 51 "app/Support/State.php",
54 52 "app/Support/Globals.php"
55 53 ]
... ...

  notas.txt
... ... @@ -15,10 +15,3 @@ largo
15 15 . que cuando recupere un turno pendiente en estado 'atendiendo' en pantalla turno, muestre el tiempo
transcurrido desde que empezo el turno en el timer
16 16
17 17 hecho
18 - . fix loader cuando login
19 - . poner feedback
20 - . recuperar turno pendiente cuando recarga pagina turno
21 - . poner nombre tramite en vista turnos
22 - . prioritario -> icono embarazada y adulto mayor y otro
23 - . mostrar label del empleado en navbar
24 - . sistema de turnos por colas, cola = servicio. empleado libre pide gente para su servicio -- coleccion
employee-service.

  resources/views/layouts/navbars/sidebar.blade.php
... ... @@ -61,11 +61,11 @@
61 61 </div>
62 62 </div>
63 63 </div>
64 - {{-- {{ dd(\State::get('employeeServices')) }} --}}
65 - {{-- title="{!! implode("&#010;", $employeeLabel) !!}"> --}}
64 + {{-- {{ dd(\State::get('employeeServices')->pluck('turnLabel')->all()) }} --}}
66 65 <!-- Employee label -->
67 66 <div class="p-3 d-flex flex-column align-items-center justify-content-center font-weight-bold
text-uppercase text-primary"
68 - style="letter-spacing: 1px">
67 + style="letter-spacing: 1px"
68 + title="{!! implode("&#010;", \State::get('employeeServices')->pluck('name')->all()) !!}">
69 69 <img src="{{ asset('images/window.png') }}" width="30" alt="">
70 70 <b>{{ \State::get('employee.label') }}</b>
71 71 </div>
... ...

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/1fc49d3af1d481c73e58f2711c806b94bc706e4c 3/4
29/6/2020 Muestra servicios en texto de label empleado (1fc49d3a) · Commits · Guillermo Agudelo / transito-frontend · GitLab

Write a comment or drag your files here…

Markdown and quick actions are supported

https://gitlab.com/guille.agudelo/transito-frontend/-/commit/1fc49d3af1d481c73e58f2711c806b94bc706e4c 4/4

Вам также может понравиться