diff --git a/.idea/contabilidad.iml b/.idea/contabilidad.iml
deleted file mode 100644
index 8558fe5..0000000
--- a/.idea/contabilidad.iml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index e783343..0000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/api/common/Controller/Files.php b/api/common/Controller/Files.php
new file mode 100644
index 0000000..6441a24
--- /dev/null
+++ b/api/common/Controller/Files.php
@@ -0,0 +1,77 @@
+listFiles();
+ usort($files, function($a, $b) {
+ $f = strcmp($a->folder, $b->folder);
+ if ($f == 0) {
+ return strcmp($a->filename, $b->filename);
+ }
+ return $f;
+ });
+ return $this->withJson($response, compact('files'));
+ }
+ public function upload(Request $request, Response $response, Handler $handler, Factory $factory): Response {
+ $post = $request->getParsedBody();
+ $cuenta = $factory->find(Cuenta::class)->one($post['cuenta']);
+ $file = $request->getUploadedFiles()['archivo'];
+ $new_name = implode(' - ', [$cuenta->nombre, $cuenta->categoria()->nombre, $post['fecha']]);
+ $output = [
+ 'input' => [
+ 'name' => $file->getClientFilename(),
+ 'type' => $file->getClientMediaType(),
+ 'size' => $file->getSize(),
+ 'error' => $file->getError()
+ ],
+ 'new_name' => $new_name,
+ 'uploaded' => $handler->uploadFile($file, $new_name)
+ ];
+ return $this->withJson($response, $output);
+ }
+ public function get(Request $request, Response $response, Handler $handler, $folder, $filename): Response {
+ $file = $handler->getFile($folder, $filename);
+ return $response
+ ->withHeader('Content-Type', $handler->getType($folder))
+ ->withHeader('Content-Disposition', 'attachment; filename=' . $filename)
+ ->withAddedHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
+ ->withHeader('Cache-Control', 'post-check=0, pre-check=0')
+ ->withHeader('Pragma', 'no-cache')
+ ->withBody($file);
+ }
+ public function edit(Request $request, Response $response, Handler $handler, Factory $factory, $folder, $filename): Response {
+ $post = json_decode($request->getBody());
+ $cuenta = $factory->find(Cuenta::class)->one($post->cuenta);
+ $filenfo = $handler->getInfo($folder, $filename);
+ $new_name = implode('.', [implode(' - ', [$cuenta->nombre, $cuenta->categoria()->nombre, $post->fecha]), $filenfo->getExtension()]);
+ $output = [
+ 'input' => [
+ 'folder' => $folder,
+ 'filename' => $filename,
+ 'post' => $post
+ ],
+ 'edited' => $handler->editFilename($folder, $filename, $new_name)
+ ];
+ return $this->withJson($response, $output);
+ }
+ public function delete(Request $request, Response $response, Handler $handler, $folder, $filename): Response {
+ $output = [
+ 'input' => [
+ 'folder' => $folder,
+ 'filename' => $filename
+ ],
+ 'deleted' => $handler->deleteFile($folder, $filename)
+ ];
+ return $this->withJson($response, $output);
+ }
+}
diff --git a/api/common/Service/FileHandler.php b/api/common/Service/FileHandler.php
new file mode 100644
index 0000000..5d06b1b
--- /dev/null
+++ b/api/common/Service/FileHandler.php
@@ -0,0 +1,109 @@
+base_folder = $params->folder;
+ $this->addValidTypes(array_keys($params->types));
+ $this->addFolders($params->types);
+ }
+ public function addFolders(array $folders): FileHandler {
+ foreach ($folders as $type => $folder) {
+ $this->addFolder($type, $folder);
+ }
+ return $this;
+ }
+ public function addFolder(string $type, string $folder): FileHandler {
+ $this->folders[$type] = $folder;
+ return $this;
+ }
+ public function addValidTypes(array $valid_types): FileHandler {
+ foreach ($valid_types as $type) {
+ $this->addValidType($type);
+ }
+ return $this;
+ }
+ public function addValidType(string $type): FileHandler {
+ $this->valid_types []= $type;
+ return $this;
+ }
+ public function getType(string $folder): string {
+ return array_search($folder, $this->folders);
+ }
+
+ public function uploadFile(UploadedFileInterface $file, string $new_name = null): bool {
+ if ($file->getError() !== UPLOAD_ERR_OK) {
+ return false;
+ }
+ if (!in_array($file->getClientMediaType(), array_keys($this->valid_types))) {
+ return false;
+ }
+ if ($new_name === null) {
+ $new_name = $file->getClientFilename();
+ }
+ $filenfo = new \SplFileInfo($file->getClientFilename());
+ if (!str_contains($new_name, $filenfo->getExtension())) {
+ $new_name .= '.' . $filenfo->getExtension();
+ }
+ $to = implode(DIRECTORY_SEPARATOR, [$this->base_folder, $this->folders[$file->getClientMediaType()], $new_name]);
+ $file->moveTo($to);
+ return file_exists($to);
+ }
+ public function listFiles(): array {
+ $output = [];
+ foreach ($this->folders as $f) {
+ $folder = implode(DIRECTORY_SEPARATOR, [$this->base_folder, $f]);
+ $files = new \DirectoryIterator($folder);
+ foreach ($files as $file) {
+ if ($file->isDir()) {
+ continue;
+ }
+ $output []= (object) ['folder' => $f, 'filename' => $file->getBasename()];
+ }
+ }
+ return $output;
+ }
+ protected function validateFilename(string $folder, string $filename): bool|string {
+ if (!in_array($folder, $this->folders)) {
+ return false;
+ }
+ $f = implode(DIRECTORY_SEPARATOR, [$this->base_folder, $folder, $filename]);
+ if (!file_exists($f)) {
+ return false;
+ }
+ return $f;
+ }
+ public function getInfo(string $folder, string $filename): \SplFileInfo|bool {
+ if (!$f = $this->validateFilename($folder, $filename)) {
+ return false;
+ }
+ return new \SplFileInfo($f);
+ }
+ public function getFile(string $folder, string $filename): StreamInterface|bool {
+ if (!$f = $this->validateFilename($folder, $filename)) {
+ return false;
+ }
+ return Stream::create(file_get_contents($f));
+ }
+ public function editFilename(string $folder, string $filename, string $new_name): bool {
+ if (!$f = $this->validateFilename($folder, $filename)) {
+ return false;
+ }
+ $info = new \SplFileInfo($f);
+ $new = implode(DIRECTORY_SEPARATOR, [$this->base_folder, $folder, $new_name . '.' . $info->getExtension()]);
+ return rename($f, $new);
+ }
+ public function deleteFile(string $folder, string $filename): bool {
+ if (!$f = $this->validateFilename($folder, $filename)) {
+ return false;
+ }
+ return unlink($f);
+ }
+}
diff --git a/api/nginx.conf b/api/nginx.conf
index 5d96382..069343f 100644
--- a/api/nginx.conf
+++ b/api/nginx.conf
@@ -15,8 +15,7 @@ server {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,
- X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+ add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Content-Type' 'application/json';
add_header 'Content-Length' 0;
@@ -24,8 +23,7 @@ server {
}
add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,
- X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+ add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
try_files $uri =404;
diff --git a/api/public/uploads/pdfs/BICE-CC-2021-09.pdf b/api/public/uploads/pdfs/BICE-CC-2021-09.pdf
deleted file mode 100644
index d521655..0000000
Binary files a/api/public/uploads/pdfs/BICE-CC-2021-09.pdf and /dev/null differ
diff --git a/api/public/uploads/pdfs/Scotiabank-CC-2021-10.pdf b/api/public/uploads/pdfs/Scotiabank-CC-2021-10.pdf
deleted file mode 100644
index 8fef2f3..0000000
Binary files a/api/public/uploads/pdfs/Scotiabank-CC-2021-10.pdf and /dev/null differ
diff --git a/api/resources/routes/uploads.php b/api/resources/routes/uploads.php
new file mode 100644
index 0000000..6138be8
--- /dev/null
+++ b/api/resources/routes/uploads.php
@@ -0,0 +1,12 @@
+group('/uploads', function($app) {
+ $app->post('/add[/]', [Files::class, 'upload']);
+ $app->get('[/]', Files::class);
+});
+$app->group('/upload/{folder}/{filename}', function($app) {
+ $app->put('[/]', [Files::class, 'edit']);
+ $app->delete('[/]', [Files::class, 'delete']);
+ $app->get('[/]', [Files::class, 'get']);
+});
diff --git a/api/setup/settings/02_common.php b/api/setup/settings/02_common.php
index 1185ad3..eeb2bd9 100644
--- a/api/setup/settings/02_common.php
+++ b/api/setup/settings/02_common.php
@@ -19,7 +19,7 @@ return [
'public'
]);
$arr['uploads'] = implode(DIRECTORY_SEPARATOR, [
- $arr['public'],
+ $arr['base'],
'uploads'
]);
$arr['pdfs'] = implode(DIRECTORY_SEPARATOR, [
diff --git a/api/setup/setups/02_common.php b/api/setup/setups/02_common.php
index 27836d5..56eabc2 100644
--- a/api/setup/setups/02_common.php
+++ b/api/setup/setups/02_common.php
@@ -14,27 +14,27 @@ return [
$c->get(Contabilidad\Common\Service\Auth::class)
);
},
- Contabilidad\Common\Service\PdfHandler::class => function(Container $c) {
- return new Contabilidad\Common\Service\PdfHandler($c->get(GuzzleHttp\Client::class), $c->get('folders')->pdfs, implode('/', [
- $c->get('urls')->python,
- 'pdf',
- 'parse'
- ]));
- },
- Contabilidad\Common\Service\CsvHandler::class => function(Container $c) {
- return new Contabilidad\Common\Service\CsvHandler($c->get('folders')->csvs);
- },
- Contabilidad\Common\Service\XlsHandler::class => function(Container $c) {
- return new Contabilidad\Common\Service\XlsHandler($c->get('folders')->xlss);
- },
- Contabilidad\Common\Service\DocumentHandler::class => function(Container $c) {
- $handlers = [
- $c->get(Contabilidad\Common\Service\XlsHandler::class),
- $c->get(Contabilidad\Common\Service\CsvHandler::class),
- $c->get(Contabilidad\Common\Service\PdfHandler::class)
- ];
- return new Contabilidad\Common\Service\DocumentHandler($handlers);
- },
+ Contabilidad\Common\Service\PdfHandler::class => function(Container $c) {
+ return new Contabilidad\Common\Service\PdfHandler($c->get(GuzzleHttp\Client::class), $c->get('folders')->pdfs, implode('/', [
+ $c->get('urls')->python,
+ 'pdf',
+ 'parse'
+ ]));
+ },
+ Contabilidad\Common\Service\CsvHandler::class => function(Container $c) {
+ return new Contabilidad\Common\Service\CsvHandler($c->get('folders')->csvs);
+ },
+ Contabilidad\Common\Service\XlsHandler::class => function(Container $c) {
+ return new Contabilidad\Common\Service\XlsHandler($c->get('folders')->xlss);
+ },
+ Contabilidad\Common\Service\DocumentHandler::class => function(Container $c) {
+ $handlers = [
+ $c->get(Contabilidad\Common\Service\XlsHandler::class),
+ $c->get(Contabilidad\Common\Service\CsvHandler::class),
+ $c->get(Contabilidad\Common\Service\PdfHandler::class)
+ ];
+ return new Contabilidad\Common\Service\DocumentHandler($handlers);
+ },
Contabilidad\Common\Service\TiposCambios::class => function(Container $c) {
return new Contabilidad\Common\Service\TiposCambios(
$c->get(GuzzleHttp\Client::class),
@@ -42,5 +42,17 @@ return [
$c->get('python_api'),
$c->get('python_key')
);
+ },
+ Contabilidad\Common\Service\FileHandler::class => function(Container $c) {
+ return new Contabilidad\Common\Service\FileHandler((object) [
+ 'folder' => $c->get('folders')->uploads,
+ 'types' => [
+ 'text/csv' => 'csvs',
+ 'application/pdf' => 'pdfs',
+ 'application/vnd.ms-excel' => 'xlss',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlss',
+ 'application/json' => 'jsons'
+ ]
+ ]);
}
];
diff --git a/ui/Dockerfile b/ui/Dockerfile
index 952159e..a7a3ff8 100644
--- a/ui/Dockerfile
+++ b/ui/Dockerfile
@@ -1,5 +1,9 @@
FROM php:8-fpm
+RUN apt-get update -y && apt-get install -y git libzip-dev zip
+
+RUN docker-php-ext-install zip
+
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /app
diff --git a/ui/common/Controller/Uploads.php b/ui/common/Controller/Uploads.php
new file mode 100644
index 0000000..c04cea0
--- /dev/null
+++ b/ui/common/Controller/Uploads.php
@@ -0,0 +1,24 @@
+render($response, 'uploads.list');
+ }
+ public function get(Request $request, Response $response, Client $client, $folder, $filename): Response {
+ $resp = $client->get(implode('/', ['upload', $folder, $filename]));
+ $file = $resp->getBody();
+ return $response
+ ->withHeader('Content-Type', $resp->getHeader('Content-Type'))
+ ->withHeader('Content-Disposition', 'attachment; filename=' . $filename)
+ ->withAddedHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
+ ->withHeader('Cache-Control', 'post-check=0, pre-check=0')
+ ->withHeader('Pragma', 'no-cache')
+ ->withBody($file);
+ }
+}
diff --git a/ui/composer.json b/ui/composer.json
index 9cfd883..19237c5 100644
--- a/ui/composer.json
+++ b/ui/composer.json
@@ -8,7 +8,8 @@
"rubellum/slim-blade-view": "^0.1.1",
"nyholm/psr7-server": "^1.0",
"zeuxisoo/slim-whoops": "^0.7.3",
- "nyholm/psr7": "^1.4"
+ "nyholm/psr7": "^1.4",
+ "guzzlehttp/guzzle": "^7.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
@@ -24,11 +25,5 @@
"psr-4": {
"Contabilidad\\Common\\": "common"
}
- },
- "repositories": [
- {
- "type": "git",
- "url": "http://git.provm.cl/ProVM/controller.git"
- }
- ]
+ }
}
diff --git a/ui/public/assets/scripts/uploads.list.js b/ui/public/assets/scripts/uploads.list.js
new file mode 100644
index 0000000..24094c3
--- /dev/null
+++ b/ui/public/assets/scripts/uploads.list.js
@@ -0,0 +1,210 @@
+class Archivo {
+ constructor({folder, filename}) {
+ this.folder = folder
+ this.filename = filename
+ this.modal = null
+ }
+ setModal(modal) {
+ this.modal = modal
+ return this
+ }
+ draw() {
+ return $('
').append(
+ $(' | ').append(
+ $('').attr('class', 'item').attr('href', _urls.base + ['upload', this.folder, this.filename].join('/')).html(this.filename)
+ )
+ ).append(
+ $(' | ').attr('class', 'right aligned').append(
+ $('').attr('class', 'ui mini circular icon button').append(
+ $('').attr('class', 'edit icon')
+ ).click((e) => {
+ e.preventDefault()
+ const t = e.currentTarget
+ this.edit()
+ return false
+ })
+ ).append(
+ $('').attr('class', 'ui mini red circular icon button').append(
+ $('').attr('class', 'remove icon')
+ ).click((e) => {
+ e.preventDefault()
+ const t = e.currentTarget
+ this.remove()
+ return false
+ })
+ )
+ )
+ }
+ edit() {
+ this.modal.find('form').trigger('reset')
+ this.modal.find('form').find("[name='folder']").val(this.folder)
+ this.modal.find('form').find("[name='old_filename']").val(this.filename)
+ this.modal.find('form').find("[name='filename']").val(this.filename)
+ this.modal.modal('show')
+ }
+ remove() {
+ return sendDelete([_urls.api, 'upload', this.folder, this.filename].join('/')).then((data) => {
+ if (data.deleted) {
+ archivos.get()
+ }
+ })
+ }
+}
+const archivos = {
+ id: '#archivos',
+ archivos: [],
+ modals: {
+ add: null,
+ edit: null
+ },
+ get: function() {
+ return {
+ parent: () => {
+ let parent = $(this.id).find('tbody')
+ if (parent.length === 0) {
+ const table = $('').attr('class', 'ui striped table').append(
+ $('').append(
+ $('
').append(
+ $(' | ').html('Archivo')
+ ).append(
+ $(' | ').attr('class', 'right aligned').append(
+ $('').attr('class', 'ui tiny green circular icon button').append(
+ $('').attr('class', 'plus icon')
+ ).click((e) => {
+ e.preventDefault()
+ this.add()
+ return false
+ })
+ )
+ )
+ )
+ )
+ parent = $('')
+ table.append(parent)
+ $(this.id).append(table)
+ }
+ return parent
+ },
+ archivos: () => {
+ return sendGet(_urls.api + '/uploads').then((data) => {
+ if (data.files === null || data.files.length === 0) {
+ return
+ }
+ $.each(data.files, (i, el) => {
+ const arch = new Archivo(el)
+ arch.setModal(this.modals.edit)
+ this.archivos.push(arch)
+ })
+ }).then(() => {
+ this.draw()
+ })
+ },
+ cuentas: () => {
+ return sendGet(_urls.api + '/cuentas')
+ }
+ }
+ },
+ draw: function() {
+ const tbody = this.get().parent()
+ tbody.html('')
+ $.each(this.archivos, (i, el) => {
+ tbody.append(el.draw())
+ })
+ },
+ add: function() {
+ this.modals.add.find('form').trigger('reset')
+ this.modals.add.modal('show')
+ },
+ doAdd: function() {
+ const data = new FormData(this.modals.add.find('form'))
+ return sendPost(_urls.api + '/categorias/add', data, true).then((resp) => {
+ this.modals.add.modal('hide')
+ this.getCategorias()
+ })
+ },
+ doEdit: function() {
+ const folder = this.modals.edit.find("[name='folder']").val()
+ const filename = this.modals.edit.find("[name='old_filename']").val()
+ const data = JSON.stringify({
+ cuenta: this.modals.edit.find("[name='cuenta']").val(),
+ fecha: this.modals.edit.find("[name='fecha']").val()
+ })
+ sendPut([_urls.api, 'upload', folder, filename].join('/'), data).then((resp) => {
+ this.modals.edit.modal('hide')
+ if (resp.edited) {
+ this.get().archivos()
+ }
+ })
+ },
+ updateCalendar: function(modal) {
+ const today = new Date()
+ const start = new Date(today.getFullYear(), today.getMonth() - 1)
+ modal.find('.ui.calendar').calendar({
+ type: 'month',
+ initialDate: start,
+ maxDate: start,
+ months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
+ monthsShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
+ formatter: {
+ date: function(date, settings) {
+ if (!date) return ''
+ const year = date.getFullYear()
+ const month = date.getMonth() + 1
+ return [year, month].join('-')
+ }
+ }
+ })
+ },
+ updateCuentas: function(modal, data) {
+ if (data.cuentas === null || data.cuentas.length === 0) {
+ return
+ }
+ const select = modal.find("select[name='cuenta']")
+ let values = []
+ $.each(data.cuentas, (i, el) => {
+ const nombre = [el.nombre, el.categoria.nombre].join(' - ')
+ values.push({
+ name: nombre,
+ value: el.id,
+ text: nombre
+ })
+ })
+ select.dropdown({values})
+ },
+ setupModal: function() {
+ this.modals.add = $('#add_modal')
+ this.modals.edit = $('#edit_modal')
+ $.each(this.modals, (i, el) => {
+ el.modal().find('.close.icon').click(() => {
+ el.modal('hide')
+ })
+ this.updateCalendar(el)
+ })
+ this.modals.add.find('form').submit((e) => {
+ e.preventDefault()
+ this.doAdd()
+ return false
+ })
+ this.modals.add.find('#archivo_btn').css('cursor', 'pointer').click(() => {
+ this.modals.add.find("[name='archivo']").trigger('click')
+ })
+ this.modals.add.find("[name='archivo']").change((e) => {
+ const arch = $(e.currentTarget)
+ const filename = arch[0].files[0].name
+ this.modals.add.find('#archivo_btn').find('input').val(filename)
+ })
+ this.modals.edit.find('form').submit((e) => {
+ e.preventDefault()
+ this.doEdit()
+ return false
+ })
+ this.get().cuentas().then((data) => {
+ this.updateCuentas(this.modals.add, data)
+ this.updateCuentas(this.modals.edit, data)
+ })
+ },
+ setup: function() {
+ this.setupModal()
+ this.get().archivos()
+ }
+}
diff --git a/ui/resources/routes/uploads.php b/ui/resources/routes/uploads.php
new file mode 100644
index 0000000..af9cf9a
--- /dev/null
+++ b/ui/resources/routes/uploads.php
@@ -0,0 +1,10 @@
+group('/uploads', function($app) {
+ $app->get('/add', [Uploads::class, 'upload']);
+ $app->get('[/]', Uploads::class);
+});
+$app->group('/upload/{folder}/{filename}', function($app) {
+ $app->get('[/]', [Uploads::class, 'get']);
+});
diff --git a/ui/resources/views/config/menu.blade.php b/ui/resources/views/config/menu.blade.php
index c361fbe..6137067 100644
--- a/ui/resources/views/config/menu.blade.php
+++ b/ui/resources/views/config/menu.blade.php
@@ -1,4 +1,5 @@
diff --git a/ui/resources/views/config/menu/files.blade.php b/ui/resources/views/config/menu/files.blade.php
new file mode 100644
index 0000000..daf9486
--- /dev/null
+++ b/ui/resources/views/config/menu/files.blade.php
@@ -0,0 +1,4 @@
+
+ Archivos
+
+
diff --git a/ui/resources/views/layout/body/menu.blade.php b/ui/resources/views/layout/body/menu.blade.php
index fb6e1c3..80944d6 100644
--- a/ui/resources/views/layout/body/menu.blade.php
+++ b/ui/resources/views/layout/body/menu.blade.php
@@ -2,7 +2,6 @@
Inicio
@include('layout.body.menu.cuentas')
@include('layout.body.menu.categorias')
- Importar
diff --git a/ui/setup/setups/03_web.php b/ui/setup/setups/03_web.php
index 7ef8df1..0f5847a 100644
--- a/ui/setup/setups/03_web.php
+++ b/ui/setup/setups/03_web.php
@@ -2,15 +2,23 @@
use Psr\Container\ContainerInterface as Container;
return [
- Slim\Views\Blade::class => function(Container $c) {
- return new Slim\Views\Blade(
- $c->get('folders')->templates,
- $c->get('folders')->cache,
- null,
- [
- 'api_key' => $c->get('API_KEY'),
- 'urls' => $c->get('urls')
- ]
- );
- }
+ Slim\Views\Blade::class => function(Container $c) {
+ return new Slim\Views\Blade(
+ $c->get('folders')->templates,
+ $c->get('folders')->cache,
+ null,
+ [
+ 'api_key' => $c->get('API_KEY'),
+ 'urls' => $c->get('urls')
+ ]
+ );
+ },
+ GuzzleHttp\Client::class => function(Container $c) {
+ return new GuzzleHttp\Client([
+ 'base_uri' => 'http://api-proxy',
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $c->get('API_KEY')
+ ]
+ ]);
+ }
];