Compare commits
3 Commits
3cadaca746
...
7945579e80
Author | SHA1 | Date | |
---|---|---|---|
7945579e80 | |||
ab1647eed3 | |||
ec7d8e69ab |
14
CLI.Dockerfile
Normal file
14
CLI.Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM php:8.1-fpm
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN pecl install xdebug-3.1.3 \
|
||||
&& docker-php-ext-enable xdebug
|
||||
|
||||
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY ./cli/crontab /var/spool/cron/crontabs/root
|
||||
|
||||
CMD ["cron", "-f"]
|
@ -1,6 +1,6 @@
|
||||
FROM php:8.1-fpm
|
||||
|
||||
RUN apt-get update && apt-get install -y libzip-dev libicu-dev git libpng-dev unzip tzdata \
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libzip-dev libicu-dev git libpng-dev unzip tzdata \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN docker-php-ext-install pdo pdo_mysql zip intl gd bcmath
|
||||
|
@ -10,4 +10,4 @@ $app->group('/api', function($app) {
|
||||
include_once $file->getRealPath();
|
||||
}
|
||||
}
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\API::class));
|
||||
|
@ -3,4 +3,4 @@ use Incoviba\Controller\Inmobiliarias;
|
||||
|
||||
$app->group('/inmobiliarias', function($app) {
|
||||
$app->get('[/]', Inmobiliarias::class);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -4,7 +4,7 @@ use Incoviba\Controller\Proyectos;
|
||||
$app->group('/proyectos', function($app) {
|
||||
$app->get('/unidades[/]', [Proyectos::class, 'unidades']);
|
||||
$app->get('[/]', Proyectos::class);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
$app->group('/proyecto/{proyecto_id}', function($app) {
|
||||
$app->get('[/]', [Proyectos::class, 'show']);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -11,10 +11,10 @@ $app->group('/ventas', function($app) {
|
||||
}
|
||||
$app->get('/add[/]', [Ventas::class, 'add']);
|
||||
$app->get('[/]', Ventas::class);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
$app->group('/venta/{proyecto_nombre:[A-za-zÑñ\+\ %0-9]+}/{unidad_descripcion:[0-9]+}', function($app) {
|
||||
$app->get('[/]', [Ventas::class, 'showUnidad']);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
$app->group('/venta/{venta_id:[0-9]+}', function($app) {
|
||||
$app->group('/propietario', function($app) {
|
||||
$app->get('[/]', [Ventas::class, 'propietario']);
|
||||
@ -29,4 +29,4 @@ $app->group('/venta/{venta_id:[0-9]+}', function($app) {
|
||||
});
|
||||
$app->get('/edit[/]', [Ventas::class, 'edit']);
|
||||
$app->get('[/]', [Ventas::class, 'show']);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -4,4 +4,4 @@ use Incoviba\Controller\Search;
|
||||
$app->group('/search', function($app) {
|
||||
$app->get('[/{query}[/{tipo}[/]]]', Search::class);
|
||||
$app->post('[/]', Search::class);
|
||||
});
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -4,5 +4,5 @@ use Incoviba\Controller\Login;
|
||||
$app->group('/login', function($app) {
|
||||
$app->post('[/]', [Login::class, 'login']);
|
||||
$app->get('[/]', [Login::class, 'form']);
|
||||
});
|
||||
$app->get('/logout', [Login::class, 'logout']);
|
||||
})->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
$app->get('/logout', [Login::class, 'logout'])->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -2,4 +2,4 @@
|
||||
use Incoviba\Controller\Base;
|
||||
|
||||
$app->get('/construccion', [Base::class, 'construccion'])->setName('construccion');
|
||||
$app->get('[/]', Base::class);
|
||||
$app->get('[/]', Base::class)->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -28,7 +28,7 @@
|
||||
return {
|
||||
hoy: () => {
|
||||
const span = $('#cuotas_hoy')
|
||||
return fetch('{{$urls->api}}/ventas/cuotas/hoy').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuotas/hoy').then(response => {
|
||||
span.html('')
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
@ -48,7 +48,7 @@
|
||||
},
|
||||
pendiente: () => {
|
||||
const span = $('#cuotas_pendientes')
|
||||
return fetch('{{$urls->api}}/ventas/cuotas/pendiente').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuotas/pendiente').then(response => {
|
||||
span.html('')
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
|
@ -13,7 +13,7 @@
|
||||
proyectos: () => {
|
||||
this.draw().loading()
|
||||
const url = '{{$urls->api}}/proyectos/escriturando'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -38,7 +38,7 @@
|
||||
},
|
||||
unidades: proyecto_id => {
|
||||
const url = '{{$urls->api}}/ventas/unidades/disponibles'
|
||||
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -49,7 +49,7 @@
|
||||
},
|
||||
promesas: proyecto_id => {
|
||||
const url = '{{$urls->api}}/ventas/estados/firmar'
|
||||
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -60,7 +60,7 @@
|
||||
},
|
||||
escrituras: proyecto_id => {
|
||||
const url = '{{$urls->api}}/ventas/escrituras/estados';
|
||||
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
list.append(
|
||||
$('<div><div>').addClass('ui inline active loader')
|
||||
)
|
||||
fetch('{{$urls->api}}/ventas/cierres/vigentes').then(response => {
|
||||
fetchAPI('{{$urls->api}}/ventas/cierres/vigentes').then(response => {
|
||||
list.html('')
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
|
@ -10,7 +10,7 @@
|
||||
list.append(
|
||||
$('<div><div>').addClass('ui inline active loader')
|
||||
)
|
||||
return fetch('{{$urls->api}}/ventas/cuotas/vencer').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuotas/vencer').then(response => {
|
||||
list.html('')
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
|
@ -2,6 +2,18 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js" integrity="sha512-5cguXwRllb+6bcc2pogwIeQmQPXEzn2ddsqAexIBhh7FO1z5Hkek1J9mrK2+rmZCTU6b6pERxI7acnp1MpAg4Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function fetchAPI(url, options=null) {
|
||||
if (options === null) {
|
||||
options = {}
|
||||
}
|
||||
if (!Object.hasOwn(options, 'headers')) {
|
||||
options['headers'] = {}
|
||||
}
|
||||
if (!Object.hasOwn(options['headers'], 'Authorization')) {
|
||||
options['headers']['Authorization'] = 'Bearer {{md5($API_KEY)}}'
|
||||
}
|
||||
return fetch(url, options)
|
||||
}
|
||||
const calendar_date_options = {
|
||||
type: 'date',
|
||||
firstDayOfWeek: 1,
|
||||
|
@ -51,7 +51,7 @@
|
||||
get() {
|
||||
return {
|
||||
start: () => {
|
||||
return fetch('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/inicio').then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -60,7 +60,7 @@
|
||||
})
|
||||
},
|
||||
current: () => {
|
||||
return fetch('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/estado').then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -69,7 +69,7 @@
|
||||
})
|
||||
},
|
||||
recepcion: () => {
|
||||
return fetch('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/proyecto/' + this.id + '/recepcion').then(response => {
|
||||
if (response.ok) {
|
||||
if (response.status === 204) {
|
||||
return null
|
||||
|
@ -134,7 +134,7 @@
|
||||
return {
|
||||
superficies: () => {
|
||||
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/superficies/vendible'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -197,7 +197,7 @@
|
||||
data: {},
|
||||
get: function() {
|
||||
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -273,7 +273,7 @@
|
||||
return {
|
||||
ventas: () => {
|
||||
const url = '{{$urls->api}}/ventas'
|
||||
return fetch(url, {method: 'post', headers: {'Content-Type': 'application/json'},
|
||||
return fetchAPI(url, {method: 'post', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({proyecto_id: '{{$proyecto->id}}'})}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
@ -294,7 +294,7 @@
|
||||
},
|
||||
stock: () => {
|
||||
const url = '{{$urls->api}}/proyecto/{{$proyecto->id}}/unidades/disponibles'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -315,7 +315,7 @@
|
||||
},
|
||||
venta: venta_id => {
|
||||
const url = '{{$urls->api}}/venta/' + venta_id
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -325,7 +325,7 @@
|
||||
},
|
||||
precio: unidad_id => {
|
||||
const url = '{{$urls->api}}/ventas/precio/unidad/' + unidad_id
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
if (response.status === 204) {
|
||||
return null
|
||||
|
@ -203,7 +203,7 @@
|
||||
return {
|
||||
tipos: proyecto_id => {
|
||||
const url = '{{$urls->api}}/proyecto/' + proyecto_id + '/unidades/tipos'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -106,7 +106,7 @@
|
||||
const data = new FormData(document.getElementById('search_form'))
|
||||
const uri = '{{$urls->api}}/search'
|
||||
this.data = []
|
||||
return fetch(uri, {method: 'post', body: data}).then(response => {
|
||||
return fetchAPI(uri, {method: 'post', body: data}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -155,7 +155,7 @@
|
||||
},
|
||||
unidad: id => {
|
||||
const url = '{{$urls->api}}/ventas/unidad/' + id
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -163,7 +163,7 @@
|
||||
},
|
||||
venta: id => {
|
||||
const url = '{{$urls->api}}/venta/' + id
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -269,7 +269,7 @@
|
||||
return {
|
||||
provincias: () => {
|
||||
const uri = '{{$urls->api}}/region/' + this.data.region + '/provincias'
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -286,7 +286,7 @@
|
||||
},
|
||||
comunas: provincia_id => {
|
||||
const uri = '{{$urls->api}}/provincia/' + provincia_id + '/comunas'
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -581,7 +581,7 @@
|
||||
return {
|
||||
propietario: rut => {
|
||||
const uri = '{{$urls->api}}/ventas/propietario/' + rut.split('-')[0]
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -664,7 +664,7 @@
|
||||
return {
|
||||
unidades: () => {
|
||||
const uri = '{{$urls->api}}/proyecto/' + this.data.id + '/unidades'
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -201,7 +201,7 @@
|
||||
|
||||
this.draw().loading()
|
||||
|
||||
return fetch('{{$urls->api}}/proyectos').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/proyectos').then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -223,7 +223,7 @@
|
||||
})
|
||||
},
|
||||
cierres: proyecto_id => {
|
||||
return fetch('{{$urls->api}}/ventas/cierres',
|
||||
return fetchAPI('{{$urls->api}}/ventas/cierres',
|
||||
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
|
@ -105,7 +105,7 @@
|
||||
const cuota_id = button.data('cuota')
|
||||
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
|
||||
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
|
||||
fetch('{{$urls->api}}/ventas/cuota/abonar', {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuota/abonar', {
|
||||
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
@ -125,7 +125,7 @@
|
||||
const cuota_id = button.data('cuota')
|
||||
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
|
||||
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
|
||||
fetch('{{$urls->api}}/ventas/cuota/devolver', {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuota/devolver', {
|
||||
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
|
@ -105,7 +105,7 @@
|
||||
const cuota_id = button.data('cuota')
|
||||
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
|
||||
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
|
||||
fetch('{{$urls->api}}/ventas/cuota/depositar', {
|
||||
return fetchAPI('{{$urls->api}}/ventas/cuota/depositar', {
|
||||
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
|
@ -68,7 +68,7 @@
|
||||
return
|
||||
}
|
||||
const uri = '{{$urls->api}}/venta/{{$venta->id}}'
|
||||
return fetch(uri,
|
||||
return fetchAPI(uri,
|
||||
{method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
|
||||
).then(response => {
|
||||
if (response.ok) {
|
||||
|
@ -53,7 +53,7 @@
|
||||
method: 'post',
|
||||
body: data
|
||||
}
|
||||
return this.sent.uf[date.toISOString()] = fetch(url, options).then(response => {
|
||||
return this.sent.uf[date.toISOString()] = fetchAPI(url, options).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -75,7 +75,7 @@
|
||||
method: 'post',
|
||||
body: data
|
||||
}
|
||||
return this.sent.ipc[dateKey] = fetch(url, options).then(response => {
|
||||
return this.sent.ipc[dateKey] = fetchAPI(url, options).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -127,7 +127,7 @@
|
||||
return {
|
||||
unidades: () => {
|
||||
const url = '{{$urls->api}}/venta/' + this.id + '/unidades'
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -233,7 +233,7 @@
|
||||
return {
|
||||
ventas: () => {
|
||||
const url = '{{$urls->api}}/ventas/facturacion/proyecto/' + this.selected
|
||||
return fetch(url).then(response => {
|
||||
return fetchAPI(url).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -103,7 +103,7 @@
|
||||
ventas: proyecto_id => {
|
||||
this.data.venta_ids = []
|
||||
this.data.ventas = []
|
||||
return fetch('{{$urls->api}}/ventas',
|
||||
return fetchAPI('{{$urls->api}}/ventas',
|
||||
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}
|
||||
).then(response => {
|
||||
this.loading.precios = false
|
||||
@ -130,7 +130,7 @@
|
||||
})
|
||||
},
|
||||
venta: venta_id => {
|
||||
return fetch('{{$urls->api}}/venta/' + venta_id).then(response => {
|
||||
return fetchAPI('{{$urls->api}}/venta/' + venta_id).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
return {
|
||||
pagos: () => {
|
||||
const uri = '{{$urls->api}}/ventas/pagos/pendientes'
|
||||
fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -138,7 +138,7 @@
|
||||
return {
|
||||
pendientes: () => {
|
||||
const uri = '{{$urls->api}}/ventas/pagos/abonar'
|
||||
fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -218,7 +218,7 @@
|
||||
return {
|
||||
devueltos: () => {
|
||||
const uri = '{{$urls->api}}/ventas/pagos/rebotes'
|
||||
fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -339,7 +339,7 @@
|
||||
|
||||
$(this.ids.buttons.add).hide()
|
||||
|
||||
return fetch('{{$urls->api}}/proyectos').then(response => {
|
||||
return fetchAPI('{{$urls->api}}/proyectos').then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -357,7 +357,7 @@
|
||||
},
|
||||
precios: proyecto_id => {
|
||||
this.data.precios = []
|
||||
return fetch('{{$urls->api}}/ventas/precios',
|
||||
return fetchAPI('{{$urls->api}}/ventas/precios',
|
||||
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({proyecto_id})}
|
||||
).then(response => {
|
||||
$('.item.proyecto').css('cursor', 'default')
|
||||
@ -639,7 +639,7 @@
|
||||
fecha: $(this.ids.fields.calendar).calendar('get date'),
|
||||
valor: $(this.ids.fields.valor).val()
|
||||
}
|
||||
return fetch('{{$urls->api}}/precios/update',
|
||||
return fetchAPI('{{$urls->api}}/precios/update',
|
||||
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
|
||||
).then(response => {
|
||||
if (response.ok) {
|
||||
|
@ -79,7 +79,7 @@ Editar Propietario
|
||||
const original_id = $("[name='comuna']").val()
|
||||
const uri = '{{$urls->api}}/direcciones/comunas/find'
|
||||
const data = {direccion}
|
||||
return fetch(uri,
|
||||
return fetchAPI(uri,
|
||||
{method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
|
||||
).then(response => {
|
||||
if (response.ok) {
|
||||
@ -101,7 +101,7 @@ Editar Propietario
|
||||
const parent = $('#comunas')
|
||||
parent.hide()
|
||||
const uri = '{{$urls->api}}/direcciones/region/' + region_id + '/comunas'
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
@ -195,7 +195,7 @@ Editar Propietario
|
||||
redirect()
|
||||
return
|
||||
}
|
||||
return fetch(uri,
|
||||
return fetchAPI(uri,
|
||||
{method: 'put', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)}
|
||||
).then(response => {
|
||||
if (response.ok) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
return {
|
||||
comentarios: () => {
|
||||
const uri = '{{$urls->api}}/venta/{{$venta->id}}/comentarios'
|
||||
return fetch(uri).then(response => {
|
||||
return fetchAPI(uri).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
|
@ -176,7 +176,7 @@
|
||||
modal.find('.ui.button').click(event => {
|
||||
modal.modal('hide')
|
||||
const date = modal.find('#fecha').val()
|
||||
return fetch(uri,
|
||||
return fetchAPI(uri,
|
||||
{method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}}
|
||||
).then(response => {
|
||||
anchor.css('pointer-events', '')
|
||||
@ -206,7 +206,7 @@
|
||||
modal.modal('show')
|
||||
modal.find('.ui.button').click(event => {
|
||||
const date = modal.find('#fecha').val()
|
||||
return fetch(uri,
|
||||
return fetchAPI(uri,
|
||||
{method: 'put', body: JSON.stringify({fecha: date}), headers: {'Content-Type': 'application/json'}}
|
||||
).then(response => {
|
||||
anchor.css('pointer-events', '')
|
||||
|
@ -1,2 +1,2 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
//$app->add($app->getContainer()->get(Incoviba\Middleware\Authentication::class));
|
||||
|
@ -2,9 +2,6 @@
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
Psr\Http\Message\ResponseFactoryInterface::class => function(ContainerInterface $container) {
|
||||
return $container->get(Nyholm\Psr7\Factory\Psr17Factory::class);
|
||||
},
|
||||
Incoviba\Middleware\Authentication::class => function(ContainerInterface $container) {
|
||||
return new Incoviba\Middleware\Authentication(
|
||||
$container->get(Psr\Http\Message\ResponseFactoryInterface::class),
|
||||
@ -13,5 +10,11 @@ return [
|
||||
$container->get(Incoviba\Common\Alias\View::class),
|
||||
implode('/', [$container->get('APP_URL'), 'login'])
|
||||
);
|
||||
},
|
||||
Incoviba\Middleware\API::class => function(ContainerInterface $container) {
|
||||
return new Incoviba\Middleware\API(
|
||||
$container->get(Psr\Http\Message\ResponseFactoryInterface::class),
|
||||
$container->get('API_KEY')
|
||||
);
|
||||
}
|
||||
];
|
||||
|
@ -9,6 +9,7 @@ return [
|
||||
'money_url' => '',
|
||||
'login' => $container->get(Incoviba\Service\Login::class),
|
||||
'format' => $container->get(Incoviba\Service\Format::class),
|
||||
'API_KEY' => $container->get('API_KEY'),
|
||||
];
|
||||
if ($global_variables['login']->isIn()) {
|
||||
$global_variables['user'] = $global_variables['login']->getUser();
|
||||
|
@ -47,20 +47,20 @@ class Money
|
||||
protected function getValue(Service\Redis $redisService, string $redisKey, Service\Money $moneyService,
|
||||
DateTimeInterface $date, string $provider): float
|
||||
{
|
||||
if (isset($this->data[$date->format('Y-m-d')])) {
|
||||
return $this->data[$date->format('Y-m-d')];
|
||||
if (isset($this->data[$provider][$date->format('Y-m-d')])) {
|
||||
return $this->data[$provider][$date->format('Y-m-d')];
|
||||
}
|
||||
try {
|
||||
$this->data = (array) $this->fetchRedis($redisService, $redisKey);
|
||||
if (!isset($this->data[$date->format('Y-m-d')])) {
|
||||
$this->data[$provider] = (array) $this->fetchRedis($redisService, $redisKey);
|
||||
if (!isset($this->data[$provider][$date->format('Y-m-d')])) {
|
||||
throw new EmptyRedis($redisKey);
|
||||
}
|
||||
} catch (EmptyRedis) {
|
||||
$result = $moneyService->get($provider, $date);
|
||||
$this->data[$date->format('Y-m-d')] = $result;
|
||||
$this->saveRedis($redisService, $redisKey, $this->data, $this->time);
|
||||
$this->data[$provider][$date->format('Y-m-d')] = $result;
|
||||
$this->saveRedis($redisService, $redisKey, $this->data[$provider], $this->time);
|
||||
}
|
||||
return $this->data[$date->format('Y-m-d')];
|
||||
return $this->data[$provider][$date->format('Y-m-d')];
|
||||
}
|
||||
/*public function uf(ServerRequestInterface $request, ResponseInterface $response, Service\Redis $redisService, Service\Money $moneyService): ResponseInterface
|
||||
{
|
||||
|
13
app/src/Exception/MissingAuthorizationHeader.php
Normal file
13
app/src/Exception/MissingAuthorizationHeader.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Incoviba\Exception;
|
||||
|
||||
use Throwable;
|
||||
use Exception;
|
||||
|
||||
class MissingAuthorizationHeader extends Exception
|
||||
{
|
||||
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
40
app/src/Middleware/API.php
Normal file
40
app/src/Middleware/API.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace Incoviba\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseFactoryInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Incoviba\Exception\MissingAuthorizationHeader;
|
||||
|
||||
class API
|
||||
{
|
||||
public function __construct(protected ResponseFactoryInterface $responseFactory, protected string $key) {}
|
||||
|
||||
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
try {
|
||||
$key = $this->getKey($request);
|
||||
} catch (MissingAuthorizationHeader $exception) {
|
||||
return $this->responseFactory->createResponse(401);
|
||||
}
|
||||
if ($this->validate($key)) {
|
||||
return $handler->handle($request);
|
||||
}
|
||||
return $this->responseFactory->createResponse(403);
|
||||
}
|
||||
protected function getKey(ServerRequestInterface $request): string
|
||||
{
|
||||
$auth_headers = $request->getHeader('Authorization');
|
||||
foreach ($auth_headers as $header) {
|
||||
if (str_contains($header, 'Bearer')) {
|
||||
return substr($header, strlen('Bearer '));
|
||||
}
|
||||
}
|
||||
throw new MissingAuthorizationHeader();
|
||||
}
|
||||
protected function validate($incoming_key): bool
|
||||
{
|
||||
return $incoming_key === md5($this->key);
|
||||
}
|
||||
}
|
20
cli/common/Alias/Application.php
Normal file
20
cli/common/Alias/Application.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Alias;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Console\Application as Base;
|
||||
|
||||
class Application extends Base
|
||||
{
|
||||
public function __construct(protected ContainerInterface $container, string $name = 'UNKNOWN', string $version = 'UNKNOWN')
|
||||
{
|
||||
if ($this->container->has('APP_NAME')) {
|
||||
$name = $this->container->get('APP_NAME');
|
||||
}
|
||||
parent::__construct($name, $version);
|
||||
}
|
||||
public function getContainer(): ContainerInterface
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
}
|
29
cli/composer.json
Normal file
29
cli/composer.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "incoviba/cli",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"symfony/console": "^6.3",
|
||||
"php-di/php-di": "^7.0",
|
||||
"guzzlehttp/guzzle": "^7.8",
|
||||
"monolog/monolog": "^3.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.4",
|
||||
"kint-php/kint": "^5.1"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aldarien",
|
||||
"email": "aldarien85@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Incoviba\\Common\\": "common/",
|
||||
"Incoviba\\": "src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
}
|
||||
}
|
8
cli/crontab
Normal file
8
cli/crontab
Normal file
@ -0,0 +1,8 @@
|
||||
0 2 * * * php /code/bin/index.php ventas:cuotas:hoy
|
||||
0 2 * * * php /code/bin/index.php ventas:cuotas:pendientes
|
||||
0 2 * * * php /code/bin/index.php ventas:cuotas:vencer
|
||||
0 2 * * * php /code/bin/index.php ventas:cierres:vigentes
|
||||
0 2 * * * php /code/bin/index.php proyectos:activos
|
||||
0 2 * * * php /code/bin/index.php comunas
|
||||
0 2 * * * php /code/bin/index.php money:uf
|
||||
0 2 1 * * php /code/bin/index.php money:ipc
|
2
cli/resources/commands/comunas.php
Normal file
2
cli/resources/commands/comunas.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Comunas::class));
|
3
cli/resources/commands/money.php
Normal file
3
cli/resources/commands/money.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Money\UF::class));
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Money\IPC::class));
|
9
cli/resources/commands/proyectos.php
Normal file
9
cli/resources/commands/proyectos.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'proyectos']);
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
2
cli/resources/commands/proyectos/activos.php
Normal file
2
cli/resources/commands/proyectos/activos.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Proyectos\Activos::class));
|
9
cli/resources/commands/ventas.php
Normal file
9
cli/resources/commands/ventas.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'ventas']);
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
2
cli/resources/commands/ventas/cierres.php
Normal file
2
cli/resources/commands/ventas/cierres.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cierres\Vigentes::class));
|
4
cli/resources/commands/ventas/cuotas.php
Normal file
4
cli/resources/commands/ventas/cuotas.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\Hoy::class));
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\Pendientes::class));
|
||||
$app->add($app->getContainer()->get(Incoviba\Command\Ventas\Cuotas\PorVencer::class));
|
42
cli/setup/app.php
Normal file
42
cli/setup/app.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder;
|
||||
use Incoviba\Common\Alias\Application;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
function buildApp(): Application
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$folders = [
|
||||
'settings',
|
||||
'setups'
|
||||
];
|
||||
foreach ($folders as $folder_name) {
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder_name]);
|
||||
if (!file_exists($folder)) {
|
||||
continue;
|
||||
}
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
$builder->addDefinitions($file->getRealPath());
|
||||
}
|
||||
}
|
||||
$app = new Application($builder->build());
|
||||
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'middlewares']);
|
||||
if (file_exists($folder)) {
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
||||
}
|
||||
|
||||
return $app;
|
||||
}
|
||||
return buildApp();
|
6
cli/setup/composer.php
Normal file
6
cli/setup/composer.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__FILE__, 2),
|
||||
'vendor',
|
||||
'autoload.php'
|
||||
]);
|
11
cli/setup/middlewares/01_commands.php
Normal file
11
cli/setup/middlewares/01_commands.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
function loadCommands(&$app): void {
|
||||
$files = new FilesystemIterator($app->getContainer()->get('folders')->commands);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
||||
}
|
||||
loadCommands($app);
|
2
cli/setup/settings/env.php
Normal file
2
cli/setup/settings/env.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return $_ENV;
|
15
cli/setup/settings/folders.php
Normal file
15
cli/setup/settings/folders.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
return [
|
||||
'folders' => function() {
|
||||
$arr = ['base' => dirname(__FILE__, 3)];
|
||||
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'resources'
|
||||
]);
|
||||
$arr['commands'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'commands'
|
||||
]);
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
15
cli/setup/setups/client.php
Normal file
15
cli/setup/setups/client.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
Psr\Http\Client\ClientInterface::class => function(ContainerInterface $container) {
|
||||
return new GuzzleHttp\Client([
|
||||
'base_uri' => $container->get('API_URL'),
|
||||
'headers' => [
|
||||
'Authorization' => [
|
||||
'Bearer ' . md5($container->get('API_KEY'))
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
];
|
32
cli/setup/setups/logs.php
Normal file
32
cli/setup/setups/logs.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
Psr\Log\LoggerInterface::class => function(ContainerInterface $container) {
|
||||
return new Monolog\Logger('incoviba', [
|
||||
new Monolog\Handler\FilterHandler(
|
||||
(new Monolog\Handler\RotatingFileHandler('/logs/debug.log'))
|
||||
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
|
||||
Monolog\Level::Debug,
|
||||
Monolog\Level::Notice
|
||||
),
|
||||
new Monolog\Handler\FilterHandler(
|
||||
(new Monolog\Handler\RotatingFileHandler('/logs/error.log'))
|
||||
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
|
||||
Monolog\Level::Warning,
|
||||
Monolog\Level::Error
|
||||
),
|
||||
new Monolog\Handler\FilterHandler(
|
||||
(new Monolog\Handler\RotatingFileHandler('/logs/critical.log'))
|
||||
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)),
|
||||
Monolog\Level::Critical
|
||||
)
|
||||
], [
|
||||
$container->get(Monolog\Processor\PsrLogMessageProcessor::class),
|
||||
$container->get(Monolog\Processor\WebProcessor::class),
|
||||
$container->get(Monolog\Processor\IntrospectionProcessor::class),
|
||||
$container->get(Monolog\Processor\MemoryUsageProcessor::class),
|
||||
$container->get(Monolog\Processor\MemoryPeakUsageProcessor::class)
|
||||
]);
|
||||
}
|
||||
];
|
25
cli/src/Command/Comunas.php
Normal file
25
cli/src/Command/Comunas.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'comunas'
|
||||
)]
|
||||
class Comunas extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/direcciones/region/13/comunas';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
35
cli/src/Command/Money/IPC.php
Normal file
35
cli/src/Command/Money/IPC.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Money;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'money:ipc'
|
||||
)]
|
||||
class IPC extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$lastMonth = (new DateTimeImmutable())->sub(new DateInterval('P1M'));
|
||||
$uri = '/api/money';
|
||||
$data = [
|
||||
'provider' => 'ipc',
|
||||
'fecha' => $lastMonth->format('Y-m-1')
|
||||
];
|
||||
$output->writeln("POST {$uri}");
|
||||
$response = $this->client->post($uri, [
|
||||
'body' => http_build_query($data),
|
||||
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
|
||||
]);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
34
cli/src/Command/Money/UF.php
Normal file
34
cli/src/Command/Money/UF.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Money;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'money:uf'
|
||||
)]
|
||||
class UF extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$now = new DateTimeImmutable();
|
||||
$uri = '/api/money';
|
||||
$data = [
|
||||
'provider' => 'uf',
|
||||
'fecha' => $now->format('Y-m-d')
|
||||
];
|
||||
$output->writeln("POST {$uri}");
|
||||
$response = $this->client->post($uri, [
|
||||
'body' => http_build_query($data),
|
||||
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
|
||||
]);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Proyectos/Activos.php
Normal file
25
cli/src/Command/Proyectos/Activos.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Proyectos;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'proyectos:activos'
|
||||
)]
|
||||
class Activos extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/proyectos';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cierres/Vigentes.php
Normal file
25
cli/src/Command/Ventas/Cierres/Vigentes.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cierres;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cierres:vigentes'
|
||||
)]
|
||||
class Vigentes extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cierres/vigentes';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/Hoy.php
Normal file
25
cli/src/Command/Ventas/Cuotas/Hoy.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:hoy'
|
||||
)]
|
||||
class Hoy extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/hoy';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/Pendientes.php
Normal file
25
cli/src/Command/Ventas/Cuotas/Pendientes.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:pendientes'
|
||||
)]
|
||||
class Pendientes extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/pendientes';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/PorVencer.php
Normal file
25
cli/src/Command/Ventas/Cuotas/PorVencer.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:vencer'
|
||||
)]
|
||||
class PorVencer extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/vencer';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ services:
|
||||
env_file:
|
||||
- ${APP_PATH:-.}/.env
|
||||
- ${APP_PATH:-.}/.db.env
|
||||
- ./.key.env
|
||||
#- ${APP_PATH:-.}/.remote.env
|
||||
volumes:
|
||||
- ${APP_PATH:-.}/:/code
|
||||
@ -83,6 +84,20 @@ services:
|
||||
- "./logs:/logs"
|
||||
ports:
|
||||
- "8084:80"
|
||||
cli:
|
||||
profiles:
|
||||
- cli
|
||||
build:
|
||||
context: .
|
||||
dockerfile: CLI.Dockerfile
|
||||
container_name: incoviba_cli
|
||||
<<: *restart
|
||||
env_file:
|
||||
- ${CLI_PATH:-.}/.env
|
||||
- ./.key.env
|
||||
volumes:
|
||||
- ${CLI_PATH:-.}:/code
|
||||
- ./logs/cli:/logs
|
||||
|
||||
volumes:
|
||||
dbdata: {}
|
||||
|
Reference in New Issue
Block a user