UI incompleto
This commit is contained in:
3
ui/Dockerfile
Normal file
3
ui/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM php:8-fpm
|
||||
|
||||
WORKDIR /app
|
12
ui/common/Controller/Bancos.php
Normal file
12
ui/common/Controller/Bancos.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class Bancos {
|
||||
public function add(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'bancos.add');
|
||||
}
|
||||
}
|
12
ui/common/Controller/Categorias.php
Normal file
12
ui/common/Controller/Categorias.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class Categorias {
|
||||
public function __invoke(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'categorias.list');
|
||||
}
|
||||
}
|
15
ui/common/Controller/Cuentas.php
Normal file
15
ui/common/Controller/Cuentas.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class Cuentas {
|
||||
public function __invoke(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'cuentas.list');
|
||||
}
|
||||
public function add(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'cuentas.add');
|
||||
}
|
||||
}
|
12
ui/common/Controller/Fuentes.php
Normal file
12
ui/common/Controller/Fuentes.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class Fuentes {
|
||||
public function show(Request $request, Response $response, View $view, $fuente_id): Response {
|
||||
return $view->render($response, 'fuentes.show', compact('fuente_id'));
|
||||
}
|
||||
}
|
12
ui/common/Controller/Home.php
Normal file
12
ui/common/Controller/Home.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class Home {
|
||||
public function __invoke(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'home');
|
||||
}
|
||||
}
|
12
ui/common/Controller/TiposFuentes.php
Normal file
12
ui/common/Controller/TiposFuentes.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Controller;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Views\Blade as View;
|
||||
|
||||
class TiposFuentes {
|
||||
public function add(Request $request, Response $response, View $view): Response {
|
||||
return $view->render($response, 'tipos_fuentes.add');
|
||||
}
|
||||
}
|
34
ui/composer.json
Normal file
34
ui/composer.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "provm/contabilidad-ui",
|
||||
"description": "UI para Contabilidad",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php-di/php-di": "^6.3",
|
||||
"php-di/slim-bridge": "^3.1",
|
||||
"rubellum/slim-blade-view": "^0.1.1",
|
||||
"nyholm/psr7-server": "^1.0",
|
||||
"zeuxisoo/slim-whoops": "^0.7.3",
|
||||
"nyholm/psr7": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"kint-php/kint": "^3.3"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aldarien",
|
||||
"email": "aldarien85@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Contabilidad\\Common\\": "common"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "http://git.provm.cl/ProVM/controller.git"
|
||||
}
|
||||
]
|
||||
}
|
22
ui/nginx.conf
Normal file
22
ui/nginx.conf
Normal file
@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html index.htm;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
root /app/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass ui:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
BIN
ui/public/assets/images/abacus-icon.png
Normal file
BIN
ui/public/assets/images/abacus-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
ui/public/assets/images/fund-accounting.png
Normal file
BIN
ui/public/assets/images/fund-accounting.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
91
ui/public/assets/scripts/categorias.list.js
Normal file
91
ui/public/assets/scripts/categorias.list.js
Normal file
@ -0,0 +1,91 @@
|
||||
const categorias = {
|
||||
id: '#categorias',
|
||||
categorias: [],
|
||||
modal: null,
|
||||
getCategorias: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/categorias',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.categorias === null || data.categorias.length == 0) {
|
||||
return
|
||||
}
|
||||
this.categorias = data.categorias
|
||||
}).then(() => {
|
||||
this.draw()
|
||||
})
|
||||
},
|
||||
getParent: function() {
|
||||
let parent = $(this.id).find('tbody')
|
||||
if (parent.length == 0) {
|
||||
const table = $('<table></table>').attr('class', 'ui table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').html('Categoría')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
table.find('.ui.button').click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
$(this.id).append(table)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
draw: function() {
|
||||
const parent = this.getParent()
|
||||
parent.html('')
|
||||
$.each(this.categorias, (i, el) => {
|
||||
parent.append(
|
||||
$('<tr></tr>').append(
|
||||
$('<td></td>').html(el.nombre)
|
||||
)
|
||||
)
|
||||
})
|
||||
},
|
||||
add: function() {
|
||||
this.modal.find('form').trigger('reset')
|
||||
this.modal.modal('show')
|
||||
},
|
||||
doAdd: function() {
|
||||
const data = JSON.stringify({
|
||||
nombre: $("[name='nombre']").val()
|
||||
})
|
||||
return $.ajax({
|
||||
url: _urls.api + '/categorias/add',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
this.modal.modal('hide')
|
||||
this.getCategorias()
|
||||
})
|
||||
},
|
||||
setupModal: function() {
|
||||
this.modal = $('.ui.modal')
|
||||
this.modal.modal()
|
||||
this.modal.find('.close.icon').click(() => {
|
||||
this.modal.modal('hide')
|
||||
})
|
||||
this.modal.find('form').submit((e) => {
|
||||
e.preventDefault()
|
||||
this.doAdd()
|
||||
return false
|
||||
})
|
||||
},
|
||||
setup: function() {
|
||||
this.setupModal()
|
||||
this.getCategorias()
|
||||
}
|
||||
}
|
125
ui/public/assets/scripts/cuentas.list.js
Normal file
125
ui/public/assets/scripts/cuentas.list.js
Normal file
@ -0,0 +1,125 @@
|
||||
const cuentas = {
|
||||
id: '#cuentas',
|
||||
cuentas: [],
|
||||
categorias: [],
|
||||
getCuentas: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/cuentas',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.cuentas === null || data.cuentas.length == 0) {
|
||||
return
|
||||
}
|
||||
this.cuentas = data.cuentas
|
||||
}).then(() => {
|
||||
this.draw()
|
||||
})
|
||||
},
|
||||
getCategorias: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/categorias',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.categorias === null || data.categorias.length == 0) {
|
||||
return
|
||||
}
|
||||
this.categorias = data.categorias
|
||||
}).then(() => {
|
||||
this.drawCategorias()
|
||||
})
|
||||
},
|
||||
drawCategorias: function() {
|
||||
const select = $("[name='categoria']")
|
||||
$.each(this.categorias, (i, el) => {
|
||||
select.append(
|
||||
$('<option></option>').attr('value', el.id).html(el.nombre)
|
||||
)
|
||||
})
|
||||
},
|
||||
buildParent: function(segment) {
|
||||
const table = $('<table></table>').attr('class', 'ui table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').html('Cuenta')
|
||||
).append(
|
||||
$('<th></th>').html('Categoría')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
table.find('.ui.button').click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
segment.append(table)
|
||||
return parent
|
||||
},
|
||||
getParent: function() {
|
||||
const segment = $(this.id)
|
||||
let parent = segment.find('tbody')
|
||||
if (parent.length == 0) {
|
||||
parent = this.buildParent(segment)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
draw: function() {
|
||||
const parent = this.getParent()
|
||||
parent.html('')
|
||||
$.each(this.cuentas, (i, el) => {
|
||||
parent.append(
|
||||
$('<tr></tr>').append(
|
||||
$('<td></td>').html(el.nombre)
|
||||
).append(
|
||||
$('<td></td>').html(el.categoria.nombre)
|
||||
)
|
||||
)
|
||||
})
|
||||
},
|
||||
add: function() {
|
||||
this.modal.find('form').trigger('reset')
|
||||
this.modal.modal('show')
|
||||
},
|
||||
doAdd: function() {
|
||||
const data = JSON.stringify({
|
||||
categoria_id: $("[name='categoria']").val(),
|
||||
nombre: $("[name='nombre']").val()
|
||||
})
|
||||
return $.ajax({
|
||||
url: _urls.api + '/cuentas/add',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
this.modal.modal('hide')
|
||||
this.getCuentas()
|
||||
})
|
||||
},
|
||||
setupModal: function() {
|
||||
this.modal = $('.ui.modal')
|
||||
this.modal.modal()
|
||||
this.modal.find('.close.icon').css('cursor', 'pointer').click(() => {
|
||||
this.modal.modal('hide')
|
||||
})
|
||||
this.modal.find('form').submit((e) => {
|
||||
e.preventDefault()
|
||||
this.doAdd()
|
||||
return false
|
||||
})
|
||||
},
|
||||
setup: function() {
|
||||
this.setupModal()
|
||||
this.getCuentas().then(() => {
|
||||
this.getCategorias()
|
||||
})
|
||||
}
|
||||
}
|
121
ui/public/assets/scripts/fuentes.show.js
Normal file
121
ui/public/assets/scripts/fuentes.show.js
Normal file
@ -0,0 +1,121 @@
|
||||
const entradas = {
|
||||
id: '#entradas',
|
||||
modal: null,
|
||||
fuente: null,
|
||||
entradas: [],
|
||||
getEntradas: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/fuente/' + this.fuente + '/entradas',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.fuente === null) {
|
||||
return
|
||||
}
|
||||
$('#fuente').html(data.fuente.tipo.descripcion + ' - ' + data.fuente.banco.nombre + ' (' + data.fuente.saldoFormateado + ')')
|
||||
if (data.entradas == null || data.entradas.length == 0) {
|
||||
return
|
||||
}
|
||||
this.entradas = data.entradas
|
||||
}).then(() => {
|
||||
this.draw()
|
||||
})
|
||||
},
|
||||
draw: function() {
|
||||
const table = $(this.id)
|
||||
table.html('')
|
||||
$.each(this.entradas, (i, el) => {
|
||||
table.append(
|
||||
$('<tr></tr>').append(
|
||||
$('<td></td>').html(el.fechaFormateada)
|
||||
).append(
|
||||
$('<td></td>').html(el.cuenta.nombre + ' (' + el.cuenta.categoria.nombre + ')')
|
||||
).append(
|
||||
$('<td></td>').html(el.glosa)
|
||||
).append(
|
||||
$('<td></td>').html(el.detalle)
|
||||
).append(
|
||||
$('<td></td>').attr('class', 'right aligned').html(el.valorFormateado)
|
||||
)
|
||||
)
|
||||
})
|
||||
},
|
||||
getCuentas: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/cuentas',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.cuentas === null || data.cuentas.length == 0) {
|
||||
return
|
||||
}
|
||||
this.cuentas = data.cuentas
|
||||
}).then(() => {
|
||||
const select = $("select[name='cuenta']")
|
||||
$.each(this.cuentas, (i, el) => {
|
||||
select.append(
|
||||
$('<option></option>').attr('value', el.id).html(el.nombre + ' (' + el.categoria.nombre + ')')
|
||||
)
|
||||
})
|
||||
})
|
||||
},
|
||||
add: function() {
|
||||
this.modal.find('form').trigger('reset')
|
||||
this.modal.modal('show')
|
||||
},
|
||||
doAdd: function() {
|
||||
const data = JSON.stringify({
|
||||
fecha: $("[name='fecha']").val(),
|
||||
fuente_id: this.fuente,
|
||||
glosa: $("[name='glosa']").val(),
|
||||
detalle: $("[name='detalle']").val(),
|
||||
cuenta_id: $("[name='cuenta']").val(),
|
||||
valor: $("[name='valor']").val()
|
||||
})
|
||||
return $.ajax({
|
||||
url: _urls.api + '/entradas/add',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
this.modal.modal('hide')
|
||||
this.getEntradas()
|
||||
})
|
||||
},
|
||||
setupModal: function() {
|
||||
this.modal = $('.ui.modal')
|
||||
this.modal.modal()
|
||||
this.modal.find('.ui.calendar').calendar({
|
||||
type: 'date',
|
||||
formatter: {
|
||||
date: function(date, settings) {
|
||||
if (!date) return ''
|
||||
let day = date.getDate()
|
||||
let month = ('00' + (date.getMonth() + 1)).slice(-2)
|
||||
let year = date.getFullYear()
|
||||
return year + '/' + month + '/' + day
|
||||
}
|
||||
},
|
||||
maxDate: new Date()
|
||||
})
|
||||
this.modal.find('.close.icon').css('cursor', 'pointer').click(() => {
|
||||
this.modal.modal('hide')
|
||||
})
|
||||
this.modal.find('form').submit((e) => {
|
||||
e.preventDefault()
|
||||
this.doAdd()
|
||||
return false
|
||||
})
|
||||
},
|
||||
setup: function() {
|
||||
this.setupModal()
|
||||
this.getEntradas().then(() => {
|
||||
this.getCuentas()
|
||||
})
|
||||
$(this.id).parent().find('.ui.button').click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
136
ui/public/assets/scripts/home.js
Normal file
136
ui/public/assets/scripts/home.js
Normal file
@ -0,0 +1,136 @@
|
||||
const fuentes = {
|
||||
id: '#fuentes',
|
||||
fuentes: [],
|
||||
tipos: [],
|
||||
bancos: [],
|
||||
modal: null,
|
||||
getParent: function() {
|
||||
let parent = $(this.id)
|
||||
if (parent.length === 0) {
|
||||
const table = $('<table></table>').attr('class', 'ui table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').html('Fuente')
|
||||
).append(
|
||||
$('<th></th>').html('Saldo')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
).click(() => {
|
||||
this.add()
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
parent = $('<tbody></tbody>').attr('id', this.id)
|
||||
table.append(parent)
|
||||
$('h1.header').after(table)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
setup: async function() {
|
||||
this.modal = $('.ui.modal')
|
||||
this.modal.modal()
|
||||
this.modal.find('.close.icon').css('cursor', 'pointer').click(() => {
|
||||
this.modal.modal('hide')
|
||||
})
|
||||
this.getFuentes().then(() => {
|
||||
this.getTipos().then(() => {
|
||||
this.getBancos()
|
||||
})
|
||||
})
|
||||
},
|
||||
add: function() {
|
||||
this.modal.find('form').trigger('reset')
|
||||
this.modal.find('form').submit((e) => {
|
||||
e.preventDefault()
|
||||
this.doAdd()
|
||||
return false
|
||||
})
|
||||
this.modal.modal('show')
|
||||
},
|
||||
doAdd: function() {
|
||||
const data = JSON.stringify({
|
||||
tipo_id: $("select[name='tipo']").val(),
|
||||
banco_id: $("select[name='banco']").val()
|
||||
})
|
||||
$.ajax({
|
||||
url: _urls.api + '/fuentes/add',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
this.modal.modal('hide')
|
||||
this.getFuentes()
|
||||
})
|
||||
},
|
||||
getFuentes: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/fuentes',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.fuentes === null || data.fuentes.length == 0) {
|
||||
return
|
||||
}
|
||||
this.fuentes = data.fuentes
|
||||
}).then(() => {
|
||||
this.draw()
|
||||
})
|
||||
},
|
||||
getTipos: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/tipos_fuentes',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.tipos_fuentes === null || data.tipos_fuentes.length == 0) {
|
||||
return
|
||||
}
|
||||
this.tipos = data.tipos_fuentes
|
||||
}).then(() => {
|
||||
const select = $("select[name='tipo']")
|
||||
select.html('')
|
||||
$.each(this.tipos, (i, el) => {
|
||||
select.append(
|
||||
$('<option></option>').attr('value', el.id).html(el.descripcion)
|
||||
)
|
||||
})
|
||||
select.dropdown()
|
||||
})
|
||||
},
|
||||
getBancos: function() {
|
||||
return $.ajax({
|
||||
url: _urls.api + '/bancos',
|
||||
method: 'GET',
|
||||
dataType: 'json'
|
||||
}).then((data) => {
|
||||
if (data.bancos === null || data.bancos.length == 0) {
|
||||
return
|
||||
}
|
||||
this.bancos = data.bancos
|
||||
}).then(() => {
|
||||
const select = $("select[name='banco']")
|
||||
$.each(this.bancos, (i, el) => {
|
||||
select.append(
|
||||
$('<option></option>').attr('value', el.id).html(el.nombre)
|
||||
)
|
||||
})
|
||||
})
|
||||
},
|
||||
draw: function() {
|
||||
const parent = this.getParent()
|
||||
$.each(this.fuentes, (i, el) => {
|
||||
const f = $('<tr></tr>').append(
|
||||
$('<td></td>').append(
|
||||
$('<a></a>').attr('href', _urls.base + 'fuente/' + el.id).html(el.tipo.descripcion + ' - ' + el.banco.nombre)
|
||||
)
|
||||
).append(
|
||||
$('<td></td>').html(el.saldoFormateado)
|
||||
)
|
||||
parent.append(f)
|
||||
})
|
||||
}
|
||||
}
|
7
ui/public/index.php
Normal file
7
ui/public/index.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
require_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'setup',
|
||||
'app.php'
|
||||
]);
|
||||
$app->run();
|
4
ui/resources/routes/bancos.php
Normal file
4
ui/resources/routes/bancos.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\Bancos;
|
||||
|
||||
$app->get('/bancos/add', [Bancos::class, 'add']);
|
4
ui/resources/routes/categorias.php
Normal file
4
ui/resources/routes/categorias.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\Categorias;
|
||||
|
||||
$app->get('/categorias', Categorias::class);
|
4
ui/resources/routes/cuentas.php
Normal file
4
ui/resources/routes/cuentas.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\Cuentas;
|
||||
|
||||
$app->get('/cuentas', Cuentas::class);
|
4
ui/resources/routes/fuentes.php
Normal file
4
ui/resources/routes/fuentes.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\Fuentes;
|
||||
|
||||
$app->get('/fuente/{fuente_id}', [Fuentes::class, 'show']);
|
4
ui/resources/routes/home.php
Normal file
4
ui/resources/routes/home.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\Home;
|
||||
|
||||
$app->get('[/]', Home::class);
|
4
ui/resources/routes/tipos_fuentes.php
Normal file
4
ui/resources/routes/tipos_fuentes.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Contabilidad\Common\Controller\TiposFuentes;
|
||||
|
||||
$app->get('/tipos_fuentes/add', [TiposFuentes::class, 'add']);
|
14
ui/resources/views/bancos/base.blade.php
Normal file
14
ui/resources/views/bancos/base.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
@hasSection('bancos_title')
|
||||
Banco @yield('bancos_title')
|
||||
@else
|
||||
Bancos
|
||||
@endif
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
@yield('bancos_content')
|
||||
</div>
|
||||
@endsection
|
14
ui/resources/views/categorias/base.blade.php
Normal file
14
ui/resources/views/categorias/base.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
@hasSection('categorias_title')
|
||||
Categoría @yield('categorias_title')
|
||||
@else
|
||||
Categorías
|
||||
@endif
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
@yield('categorias_content')
|
||||
</div>
|
||||
@endsection
|
28
ui/resources/views/categorias/list.blade.php
Normal file
28
ui/resources/views/categorias/list.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
@extends('categorias.base')
|
||||
|
||||
@section('categorias_content')
|
||||
<div id="categorias"></div>
|
||||
<div class="ui modal">
|
||||
<i class="close icon"></i>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="field">
|
||||
<label>Nombre</label>
|
||||
<input type="text" name="nombre" />
|
||||
</div>
|
||||
<button class="ui icon button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{$urls->scripts}}/categorias.list.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(() => {
|
||||
categorias.setup()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
14
ui/resources/views/cuentas/base.blade.php
Normal file
14
ui/resources/views/cuentas/base.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
@hasSection('cuentas_title')
|
||||
Cuenta @yield('cuentas_title')
|
||||
@else
|
||||
Cuentas
|
||||
@endif
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
@yield('cuentas_content')
|
||||
</div>
|
||||
@endsection
|
32
ui/resources/views/cuentas/list.blade.php
Normal file
32
ui/resources/views/cuentas/list.blade.php
Normal file
@ -0,0 +1,32 @@
|
||||
@extends('cuentas.base')
|
||||
|
||||
@section('cuentas_content')
|
||||
<div id="cuentas"></div>
|
||||
<div class="ui modal">
|
||||
<i class="close icon"></i>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="inline field">
|
||||
<label>Categoría</label>
|
||||
<select name="categoria"></select>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label>Nombre</label>
|
||||
<input type="text" name="nombre" />
|
||||
</div>
|
||||
<button class="ui icon button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{$urls->scripts}}/cuentas.list.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(() => {
|
||||
cuentas.setup()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
14
ui/resources/views/fuentes/base.blade.php
Normal file
14
ui/resources/views/fuentes/base.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
@hasSection('fuentes_title')
|
||||
Fuente @yield('fuentes_title')
|
||||
@else
|
||||
Fuentes
|
||||
@endif
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
@yield('fuentes_content')
|
||||
</div>
|
||||
@endsection
|
81
ui/resources/views/fuentes/show.blade.php
Normal file
81
ui/resources/views/fuentes/show.blade.php
Normal file
@ -0,0 +1,81 @@
|
||||
@extends('fuentes.base')
|
||||
|
||||
@section('fuentes_title')
|
||||
<span id="fuente"></span>
|
||||
@endsection
|
||||
|
||||
@section('fuentes_content')
|
||||
<table class="ui table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Fecha
|
||||
</th>
|
||||
<th>
|
||||
Cuenta
|
||||
</th>
|
||||
<th>
|
||||
Glosa
|
||||
</th>
|
||||
<th>
|
||||
Detalle
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
Valor
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
<button class="ui tiny green circular icon button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="entradas">
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="ui modal">
|
||||
<i class="close icon"></i>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="field">
|
||||
<label>Fecha</label>
|
||||
<div class="ui calendar">
|
||||
<div class="ui input left icon">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="fecha" placeholder="Fecha" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Cuenta</label>
|
||||
<select name="cuenta"></select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Glosa</label>
|
||||
<input type="text" name="glosa" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Detalle</label>
|
||||
<input type="text" name="detalle" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Valor</label>
|
||||
<input type="text" name="valor" />
|
||||
</div>
|
||||
<button class="ui icon button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{$urls->scripts}}/fuentes.show.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(() => {
|
||||
entradas.fuente = {{$fuente_id}}
|
||||
entradas.setup()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
34
ui/resources/views/home.blade.php
Normal file
34
ui/resources/views/home.blade.php
Normal file
@ -0,0 +1,34 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
Contabilidad
|
||||
</h1>
|
||||
<div class="ui modal">
|
||||
<i class="close icon"></i>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="field">
|
||||
<label>Tipo</label>
|
||||
<select name="tipo"></select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Banco</label>
|
||||
<select name="banco"></select>
|
||||
</div>
|
||||
<button class="ui icon button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{$urls->scripts}}/home.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(() => {
|
||||
fuentes.setup()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
5
ui/resources/views/layout/base.blade.php
Normal file
5
ui/resources/views/layout/base.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
@include('layout.head')
|
||||
@include('layout.body')
|
||||
</html>
|
5
ui/resources/views/layout/body.blade.php
Normal file
5
ui/resources/views/layout/body.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<body>
|
||||
@include('layout.body.header')
|
||||
@yield('page_content')
|
||||
@include('layout.body.footer')
|
||||
</body>
|
4
ui/resources/views/layout/body/footer.blade.php
Normal file
4
ui/resources/views/layout/body/footer.blade.php
Normal file
@ -0,0 +1,4 @@
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
@include('layout.body.scripts')
|
3
ui/resources/views/layout/body/header.blade.php
Normal file
3
ui/resources/views/layout/body/header.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<header>
|
||||
@include('layout.body.menu')
|
||||
</header>
|
5
ui/resources/views/layout/body/menu.blade.php
Normal file
5
ui/resources/views/layout/body/menu.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<nav class="ui menu">
|
||||
<a class="item" href="{{$urls->base}}">Inicio</a>
|
||||
@include('layout.body.menu.cuentas')
|
||||
@include('layout.body.menu.categorias')
|
||||
</nav>
|
3
ui/resources/views/layout/body/menu/categorias.blade.php
Normal file
3
ui/resources/views/layout/body/menu/categorias.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<a class="item" href="{{$urls->base}}categorias">
|
||||
Categorías
|
||||
</a>
|
3
ui/resources/views/layout/body/menu/cuentas.blade.php
Normal file
3
ui/resources/views/layout/body/menu/cuentas.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<a class="item" href="{{$urls->base}}cuentas">
|
||||
Cuentas
|
||||
</a>
|
11
ui/resources/views/layout/body/scripts.blade.php
Normal file
11
ui/resources/views/layout/body/scripts.blade.php
Normal file
@ -0,0 +1,11 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/semantic.min.js" integrity="sha512-t5mAtfZZmR2gl5LK7WEkJoyHCfyzoy10MlerMGhxsXl3J7uSSNTAW6FK/wvGBC8ua9AFazwMaC0LxsMTMiM5gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
const _urls = {
|
||||
base: '{{$urls->base}}',
|
||||
api: '{{$urls->api}}'
|
||||
}
|
||||
</script>
|
||||
|
||||
@stack('scripts')
|
5
ui/resources/views/layout/head.blade.php
Normal file
5
ui/resources/views/layout/head.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Contabilidad</title>
|
||||
@include('layout.head.styles')
|
||||
</head>
|
8
ui/resources/views/layout/head/styles.blade.php
Normal file
8
ui/resources/views/layout/head/styles.blade.php
Normal file
@ -0,0 +1,8 @@
|
||||
<link rel="icon" href="{{$urls->images}}/fund-accounting.png" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/semantic.min.css" integrity="sha512-pbLYRiE96XJxmJgF8oWBfa9MdKwuXhlV7vgs2LLlapHLXceztfcta0bdeOgA4reIf0WH67ThWzA684JwkM3zfQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/themes/default/assets/fonts/brand-icons.woff" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/themes/default/assets/fonts/icons.woff" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/themes/default/assets/fonts/outline-icons.woff" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.8/themes/github/assets/fonts/octicons.woff" />
|
||||
|
||||
@stack('styles')
|
14
ui/resources/views/tipos_fuentes/base.blade.php
Normal file
14
ui/resources/views/tipos_fuentes/base.blade.php
Normal file
@ -0,0 +1,14 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1 class="ui header">
|
||||
@hasSection('tipos_fuentes_title')
|
||||
Tipo Fuente @yield('tipos_fuentes_title')
|
||||
@else
|
||||
Tipos Fuentes
|
||||
@endif
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
@yield('tipos_fuentes_content')
|
||||
</div>
|
||||
@endsection
|
45
ui/setup/app.php
Normal file
45
ui/setup/app.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder as Builder;
|
||||
use DI\Bridge\Slim\Bridge as Bridge;
|
||||
use Zeuxisoo\Whoops\Slim\WhoopsMiddleware;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$builder = new Builder();
|
||||
$folders = [
|
||||
'settings',
|
||||
'setups'
|
||||
];
|
||||
foreach ($folders as $f) {
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, $f]);
|
||||
if (!file_exists($folder)) {
|
||||
continue;
|
||||
}
|
||||
$files = new DirectoryIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
$builder->addDefinitions($file->getRealPath());
|
||||
}
|
||||
}
|
||||
|
||||
$container = $builder->build();
|
||||
$app = Bridge::create($container);
|
||||
|
||||
$app->addRoutingMiddleware();
|
||||
$app->add(new WhoopsMiddleware());
|
||||
|
||||
|
||||
$folder = 'middlewares';
|
||||
if (file_exists($folder)) {
|
||||
$files = new DirectoryIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir() or $file->getExtension() != 'php') {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
||||
}
|
||||
|
||||
include_once 'router.php';
|
6
ui/setup/composer.php
Normal file
6
ui/setup/composer.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'vendor',
|
||||
'autoload.php'
|
||||
]);
|
9
ui/setup/router.php
Normal file
9
ui/setup/router.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$folder = $app->getContainer()->get('folders')->routes;
|
||||
$files = new DirectoryIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir() or $file->getExtension() != 'php') {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
4
ui/setup/settings/01_env.php
Normal file
4
ui/setup/settings/01_env.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'debug' => $_ENV['DEBUG'] ?? false
|
||||
];
|
27
ui/setup/settings/02_common.php
Normal file
27
ui/setup/settings/02_common.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'folders' => function(Container $c) {
|
||||
$arr = [
|
||||
'base' => dirname(__DIR__, 2)
|
||||
];
|
||||
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'resources'
|
||||
]);
|
||||
$arr['routes'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'routes'
|
||||
]);
|
||||
$arr['cache'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'cache'
|
||||
]);
|
||||
$arr['templates'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'views'
|
||||
]);
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
22
ui/setup/settings/03_web.php
Normal file
22
ui/setup/settings/03_web.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'urls' => function(Container $c) {
|
||||
$arr = ['base' => $_ENV['BASE_URL'] ?? '/'];
|
||||
$arr['assets'] = str_replace('//', '/', implode('/', [
|
||||
$arr['base'],
|
||||
'assets'
|
||||
]));
|
||||
$arr['images'] = implode('/', [
|
||||
$arr['assets'],
|
||||
'images'
|
||||
]);
|
||||
$arr['scripts'] = implode('/', [
|
||||
$arr['assets'],
|
||||
'scripts'
|
||||
]);
|
||||
$arr['api'] = $_ENV['API_URL'] ?? 'http://localhost:9001';
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
15
ui/setup/setups/03_web.php
Normal file
15
ui/setup/setups/03_web.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
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,
|
||||
[
|
||||
'urls' => $c->get('urls')
|
||||
]
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user