into develop
This commit is contained in:
2023-04-12 23:31:11 -04:00
7 changed files with 54 additions and 34 deletions

View File

@ -44,12 +44,14 @@ class Proyectos {
} }
public function operadores(Request $request, Response $response, $id_proyecto): Response { public function operadores(Request $request, Response $response, $id_proyecto): Response {
$proyecto = Model::factory(Proyecto::class)->find_one($id_proyecto); $proyecto = Model::factory(Proyecto::class)->find_one($id_proyecto);
error_log(var_export($proyecto->operadores(), true));
$output = [ $output = [
'proyecto' => $proyecto->as_array(), 'proyecto' => $proyecto->as_array(),
'operadores' => $proyecto->operadores() ? array_map(function($item) { 'operadores' => $proyecto->operadores() ? array_map(function($item) {
if ($item) { $arr = $item->as_array();
return $item->as_array(); $arr['agente_tipo'] = $item->agente_tipo()->as_array();
} $arr['agente_tipo']['agente'] = $arr['operador'] = $item->agente_tipo()->agente()->as_array();
return $arr;
}, $proyecto->operadores()) : null }, $proyecto->operadores()) : null
]; ];
return $this->withJson($response, $output); return $this->withJson($response, $output);

View File

@ -18,7 +18,7 @@ server {
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass backend:9000; fastcgi_pass operadores-backend:9000;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

View File

@ -45,12 +45,10 @@ class Proyecto extends Model {
public function operadores() { public function operadores() {
if ($this->operadores === null) { if ($this->operadores === null) {
$pas = $this->has_many(ProyectoAgente::class, 'proyecto')->find_many(); $pas = $this->has_many(ProyectoAgente::class, 'proyecto')->find_many();
$operadores = []; $pas = array_filter($pas, function($pa) {
foreach ($pas as $pa) { return ($pa->agente_tipo()->tipo() === 'operador');
$id = $pa->agente_tipo()->agente()->id; });
$operadores []= Model::factory(Operador::class)->find_one($id); $this->operadores = $pas;
}
$this->operadores = $operadores;
} }
return $this->operadores; return $this->operadores;
} }

View File

@ -1,53 +1,61 @@
version: '3' version: '3'
services: services:
backend-proxy: operadores-backend-proxy:
container_name: backend_proxy profiles:
- operadores
container_name: operadores_api
image: nginx image: nginx
volumes: volumes:
- ./api/:/app/ - ${OPERADORES_PATH:-.}/api/:/app/
- ./api/nginx.conf:/etc/nginx/conf.d/default.conf - ${OPERADORES_PATH:-.}/api/nginx.conf:/etc/nginx/conf.d/default.conf
- ./logs/api/:/var/log/nginx/ - ./logs/operadores/api/:/var/log/nginx/
restart: unless-stopped restart: unless-stopped
ports: ports:
- 8001:80 - 8001:80
depends_on: depends_on:
- backend - operadores-backend
backend: operadores-backend:
container_name: backend profiles:
- operadores
container_name: operadores_backend
restart: unless-stopped restart: unless-stopped
image: php image: php
build: build:
context: ./api context: ${OPERADROES_PATH:-.}/api
dockerfile: PHP.Dockerfile dockerfile: PHP.Dockerfile
env_file: .db.env env_file: ${OPERADORES_PATH:-.}/.db.env
volumes: volumes:
- ./api/:/app/ - ${OPERADORES_PATH:-.}/api/:/app/
# depends_on: # depends_on:
# - db # - db
frontend-proxy: operadores-frontend-proxy:
container_name: frontend_proxy profiles:
- operadores
container_name: operadores_ui
image: nginx image: nginx
volumes: volumes:
- ./ui/:/app/ - ${OPERADORES_PATH:-.}/ui/:/app/
- ./ui/nginx.conf:/etc/nginx/conf.d/default.conf - ${OPERADORES_PATH:-.}/ui/nginx.conf:/etc/nginx/conf.d/default.conf
- ./logs/ui/:/var/log/nginx/ - ./logs/operadores/ui/:/var/log/nginx/
restart: unless-stopped restart: unless-stopped
ports: ports:
- 8000:80 - 8000:80
depends_on: depends_on:
- frontend - operadores-frontend
frontend: operadores-frontend:
container_name: frontend profiles:
- operadores
container_name: operadores_frontend
restart: unless-stopped restart: unless-stopped
image: php:ui image: php:ui
build: build:
context: ./ui context: ${OPERADORES_PATH:-.}/ui
dockerfile: PHP.Dockerfile dockerfile: PHP.Dockerfile
env_file: .ui.env env_file: ${OPERADORES_PATH:-.}/.ui.env
volumes: volumes:
- ./ui/:/app/ - ${OPERADORES_PATH:-.}/ui/:/app/
# #
# db: # db:
# image: mariadb # image: mariadb
@ -68,3 +76,8 @@ services:
# #
#volumes: #volumes:
# database: # database:
networks:
default:
external: true
name: incoviba_network

View File

@ -13,7 +13,7 @@ server {
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass frontend:9000; fastcgi_pass operadores-frontend:9000;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

View File

@ -23,6 +23,13 @@
@include('layout.menu.informes') @include('layout.menu.informes')
</li> </li>
<li rol="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Operadores <span class="caret"></span>
</a>
@include('layout.menu.operadores')
</li>
<li role="presentation" class="dropdown"> <li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Operadores <span class="caret"></span> Operadores <span class="caret"></span>

View File

@ -6,6 +6,6 @@
<a href="{{$urls->base}}/ventas">Ventas</a> <a href="{{$urls->base}}/ventas">Ventas</a>
</li> </li>
<li> <li>
<a href="{{$urls->base}}/informe">Informe</a> <a href="{{$urls->base}}/facturas">Informe</a>
</li> </li>
</ul> </ul>