6 Commits

7 changed files with 47 additions and 45 deletions

View File

@ -1,16 +1,20 @@
FROM php:8.2-fpm FROM php:8.2-cli
ENV TZ "America/Santiago" ENV TZ "${TZ}"
ENV APP_NAME "${APP_NAME}"
ENV API_URL "${API_URL}"
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -r /var/lib/apt/lists/* RUN apt-get update && apt-get install -y --no-install-recommends cron rsyslog nano && rm -r /var/lib/apt/lists/*
RUN pecl install xdebug-3.2.2 \ RUN pecl install xdebug-3.2.2 \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug \
&& echo "#/bin/bash\nprintenv >> /etc/environment\ncron -f -L 11" > /root/entrypoint && chmod a+x /root/entrypoint
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
WORKDIR /code/bin WORKDIR /code/bin
COPY ./cli/crontab /var/spool/cron/crontabs/root #COPY --chmod=644 ./cli/crontab /etc/cron.d/cronjob
COPY --chmod=644 ./cli/crontab /var/spool/cron/crontabs/root
CMD ["cron", "-f"] CMD [ "/root/entrypoint" ]

View File

@ -6,7 +6,7 @@
<form id="search_form" class="ui form" action="{{$urls->base}}/search" method="post"> <form id="search_form" class="ui form" action="{{$urls->base}}/search" method="post">
<div class="field"> <div class="field">
<div class="ui fluid input" data-tooltip="Para buscar frases se deben encerrar entre comillas. ej, 'portal la viña' o &quot;portal la viña&quot;" data-position="bottom left"> <div class="ui fluid input" data-tooltip="Para buscar frases se deben encerrar entre comillas. ej, 'portal la viña' o &quot;portal la viña&quot;" data-position="top right">
<input type="text" name="query" /> <input type="text" name="query" />
</div> </div>
</div> </div>
@ -56,7 +56,7 @@
unidad.html(unidad.html() + ' (I)') unidad.html(unidad.html() + ' (I)')
} }
propietario = $('<a></a>') propietario = $('<a></a>')
.attr('href','{{$urls->base}}/search/' + encodeURIComponent(this.venta.propietario.nombre_completo) + '/propietario') .attr('href','{{$urls->base}}/search/"' + encodeURIComponent(this.venta.propietario.nombre_completo) + '"/propietario')
.html(this.venta.propietario.nombre_completo) .html(this.venta.propietario.nombre_completo)
fecha = dateFormatter.format(new Date(this.venta.fecha)) fecha = dateFormatter.format(new Date(this.venta.fecha))
if (typeof this.venta.entrega !== 'undefined') { if (typeof this.venta.entrega !== 'undefined') {
@ -309,15 +309,23 @@
} }
} }
}, },
set: function() {
return {
query: value => {
$("[name='query']").val(value)
this.get().results()
}
}
},
setup: function(id) { setup: function(id) {
this.id = id this.id = id
this.get().results() this.get().results()
$('#tipo').dropdown().dropdown('set selected', '*') $('#tipo').dropdown().dropdown('set selected', '*')
@if (trim($post) !== '') @if (trim($post) !== '')
$("[name='query']").val('{{$post}}') this.set().query('{!! $post !!}')
@elseif (trim($query) !== '') @elseif (trim($query) !== '')
$("[name='query']").val('{{$query}}') this.set().query('{!! $query !!}')
@endif @endif
@if (trim($tipo) !== '') @if (trim($tipo) !== '')
$('#tipo').dropdown('set selected', '{{$tipo}}') $('#tipo').dropdown('set selected', '{{$tipo}}')

View File

@ -4,10 +4,10 @@ use Psr\Container\ContainerInterface;
return [ return [
Incoviba\Common\Define\Database::class => function(ContainerInterface $container) { Incoviba\Common\Define\Database::class => function(ContainerInterface $container) {
return new Incoviba\Common\Implement\Database\MySQL( return new Incoviba\Common\Implement\Database\MySQL(
$container->has('MYSQL_HOST') ? $container->get('MYSQL_HOST') : 'db', $container->has('DB_HOST') ? $container->get('DB_HOST') : 'db',
$container->get('MYSQL_DATABASE'), $container->get('DB_DATABASE'),
$container->get('MYSQL_USER'), $container->get('DB_USER'),
$container->get('MYSQL_PASSWORD') $container->get('DB_PASSWORD')
); );
}, },
Incoviba\Common\Define\Connection::class => function(ContainerInterface $container) { Incoviba\Common\Define\Connection::class => function(ContainerInterface $container) {

View File

@ -142,7 +142,7 @@ class Search
} }
protected function findPago(string $query): array protected function findPago(string $query): array
{ {
if ($query != 0) { if ((int) $query === 0) {
return []; return [];
} }
$methods = [ $methods = [
@ -156,6 +156,7 @@ class Search
$pagos = []; $pagos = [];
try { try {
$pagos = $this->pagoRepository->fetchByValue((int) $valor); $pagos = $this->pagoRepository->fetchByValue((int) $valor);
error_log(var_export($pagos,true).PHP_EOL,3,'/logs/debug');
} catch (EmptyResult) {} } catch (EmptyResult) {}
$results = []; $results = [];
foreach ($methods as $method) { foreach ($methods as $method) {

5
cli/bin/incoviba Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
. /etc/profile
/usr/local/bin/php /code/bin/index.php "$@"

View File

@ -1,8 +1,8 @@
0 2 * * * php /code/bin/index.php ventas:cuotas:hoy 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:hoy >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cuotas:pendientes 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:pendientes >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cuotas:vencer 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:vencer >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cierres:vigentes 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cierres:vigentes >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php proyectos:activos 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba proyectos:activos >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php comunas 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba comunas >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php money:uf 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba money:uf >> /logs/commands 2>&1
0 2 1 * * php /code/bin/index.php money:ipc 2>&1 >> /logs/commands 0 2 1 * * /code/bin/incoviba money:ipc >> /logs/commands 2>&1

View File

@ -1,15 +1,10 @@
version: '3'
x-restart: &restart
restart: unless-stopped
services: services:
proxy: proxy:
profiles: profiles:
- app - app
image: nginx:alpine image: nginx:alpine
container_name: incoviba_proxy container_name: incoviba_proxy
<<: *restart restart: unless-stopped
ports: ports:
- "${APP_PORT}:80" - "${APP_PORT}:80"
volumes: volumes:
@ -22,12 +17,10 @@ services:
- app - app
build: . build: .
container_name: incoviba_web container_name: incoviba_web
<<: *restart restart: unless-stopped
env_file: env_file:
- ${APP_PATH:-.}/.env - ${APP_PATH:-.}/.env
- ${APP_PATH:-.}/.db.env
- ./.key.env - ./.key.env
#- ${APP_PATH:-.}/.remote.env
volumes: volumes:
- ${APP_PATH:-.}/:/code - ${APP_PATH:-.}/:/code
- ./logs/php:/logs - ./logs/php:/logs
@ -37,7 +30,7 @@ services:
- db - db
image: mariadb:latest image: mariadb:latest
container_name: incoviba_db container_name: incoviba_db
<<: *restart restart: unless-stopped
env_file: ${APP_PATH:-.}/.db.env env_file: ${APP_PATH:-.}/.db.env
volumes: volumes:
- dbdata:/var/lib/mysql - dbdata:/var/lib/mysql
@ -53,22 +46,13 @@ services:
- cache - cache
image: redis image: redis
container_name: incoviba_redis container_name: incoviba_redis
<<: *restart restart: unless-stopped
env_file: ${APP_PATH:-.}/.redis.env env_file: ${APP_PATH:-.}/.redis.env
volumes: volumes:
- incoviba_redis:/data - incoviba_redis:/data
ports: ports:
- "63790:6379" - "63790:6379"
python:
profiles:
- python
build:
context: .
dockerfile: Python.Dockerfile
container_name: incoviba_python
<<: *restart
logview: logview:
profiles: profiles:
- log - log
@ -81,7 +65,7 @@ services:
WEB_URL: 'http://provm.cl:8084' WEB_URL: 'http://provm.cl:8084'
WEB_PORT: '8084' WEB_PORT: '8084'
volumes: volumes:
- "./logs:/logs" - ./logs:/logs
ports: ports:
- "8084:80" - "8084:80"
cli: cli:
@ -91,7 +75,7 @@ services:
context: . context: .
dockerfile: CLI.Dockerfile dockerfile: CLI.Dockerfile
container_name: incoviba_cli container_name: incoviba_cli
<<: *restart restart: unless-stopped
env_file: env_file:
- ${CLI_PATH:-.}/.env - ${CLI_PATH:-.}/.env
- ./.key.env - ./.key.env