diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 73f69e0..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
-# Editor-based HTTP Client requests
-/httpRequests/
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
deleted file mode 100644
index a55e7a1..0000000
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 2081fb2..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/api/common/Controller/Files.php b/api/common/Controller/Files.php
index 6441a24..e227dc5 100644
--- a/api/common/Controller/Files.php
+++ b/api/common/Controller/Files.php
@@ -52,8 +52,7 @@ class Files {
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()]);
+ $new_name = implode(' - ', [$cuenta->nombre, $cuenta->categoria()->nombre, $post->fecha]);
$output = [
'input' => [
'folder' => $folder,
diff --git a/api/common/Service/FileHandler.php b/api/common/Service/FileHandler.php
index 7041ed2..79ee9e7 100644
--- a/api/common/Service/FileHandler.php
+++ b/api/common/Service/FileHandler.php
@@ -42,7 +42,7 @@ class FileHandler {
if ($file->getError() !== UPLOAD_ERR_OK) {
return false;
}
- if (!in_array($file->getClientMediaType(), array_keys($this->valid_types))) {
+ if (!in_array($file->getClientMediaType(), $this->valid_types)) {
return false;
}
if ($new_name === null) {
diff --git a/ui/public/assets/scripts/uploads.list.js b/ui/public/assets/scripts/uploads.list.js
index 24094c3..012618d 100644
--- a/ui/public/assets/scripts/uploads.list.js
+++ b/ui/public/assets/scripts/uploads.list.js
@@ -90,6 +90,7 @@ const archivos = {
if (data.files === null || data.files.length === 0) {
return
}
+ this.archivos = []
$.each(data.files, (i, el) => {
const arch = new Archivo(el)
arch.setModal(this.modals.edit)
@@ -106,20 +107,21 @@ const archivos = {
},
draw: function() {
const tbody = this.get().parent()
- tbody.html('')
+ tbody.empty()
$.each(this.archivos, (i, el) => {
tbody.append(el.draw())
})
},
add: function() {
this.modals.add.find('form').trigger('reset')
+ this.modals.add.find("[name='cuenta']").dropdown('clear')
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) => {
+ const data = new FormData(this.modals.add.find('form')[0])
+ return sendPost(_urls.api + '/uploads/add', data, true).then((resp) => {
this.modals.add.modal('hide')
- this.getCategorias()
+ this.get().archivos()
})
},
doEdit: function() {
@@ -149,7 +151,7 @@ const archivos = {
date: function(date, settings) {
if (!date) return ''
const year = date.getFullYear()
- const month = date.getMonth() + 1
+ const month = (date.getMonth() + 1).toString().padStart(2, '0')
return [year, month].join('-')
}
}