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 {
$proyecto = Model::factory(Proyecto::class)->find_one($id_proyecto);
error_log(var_export($proyecto->operadores(), true));
$output = [
'proyecto' => $proyecto->as_array(),
'operadores' => $proyecto->operadores() ? array_map(function($item) {
if ($item) {
return $item->as_array();
}
$arr = $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
];
return $this->withJson($response, $output);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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