Compare commits
8 Commits
b58cda3e4e
...
develop
Author | SHA1 | Date | |
---|---|---|---|
c582efcf77 | |||
f7bd54b1c2 | |||
93aa4b0576 | |||
c898bcf1d4 | |||
52e922685d | |||
71e10c52bd | |||
e672ac48a7 | |||
4f7241e146 |
4
.db.env.sample
Normal file
4
.db.env.sample
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
MYSQL_ROOT_PASSWORD=password
|
||||||
|
MYSQL_DATABASE=database
|
||||||
|
MYSQL_USER=user
|
||||||
|
MYSQL_PASSWORD=password
|
3
.ui.env.sample
Normal file
3
.ui.env.sample
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
DEBUG=true
|
||||||
|
BASE_URL=http://localhost:8080
|
||||||
|
API_URL=http://localhost:8081
|
@ -41,4 +41,10 @@ class Facturas {
|
|||||||
];
|
];
|
||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
}
|
}
|
||||||
|
public function add_venta(Request $request, Response $response, $id_factura): Response {
|
||||||
|
$post = $request->getParsedBody();
|
||||||
|
$factura = Model::factory(FacturaProyectoOperador::class)->find_one($id_factura);
|
||||||
|
$output = $factura->addVenta($post);
|
||||||
|
return $this->withJson($response, $output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,14 @@ class Proyectos {
|
|||||||
}
|
}
|
||||||
public function operadores(Request $request, Response $response, $id_proyecto): Response {
|
public function operadores(Request $request, Response $response, $id_proyecto): Response {
|
||||||
$proyecto = Model::factory(Proyecto::class)->find_one($id_proyecto);
|
$proyecto = Model::factory(Proyecto::class)->find_one($id_proyecto);
|
||||||
|
error_log(var_export($proyecto->operadores(), true));
|
||||||
$output = [
|
$output = [
|
||||||
'proyecto' => $proyecto->as_array(),
|
'proyecto' => $proyecto->as_array(),
|
||||||
'operadores' => $proyecto->operadores() ? array_map(function($item) {
|
'operadores' => $proyecto->operadores() ? array_map(function($item) {
|
||||||
if ($item) {
|
$arr = $item->as_array();
|
||||||
return $item->as_array();
|
$arr['agente_tipo'] = $item->agente_tipo()->as_array();
|
||||||
}
|
$arr['agente_tipo']['agente'] = $arr['operador'] = $item->agente_tipo()->agente()->as_array();
|
||||||
|
return $arr;
|
||||||
}, $proyecto->operadores()) : null
|
}, $proyecto->operadores()) : null
|
||||||
];
|
];
|
||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
|
@ -28,4 +28,20 @@ class Ventas {
|
|||||||
];
|
];
|
||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
}
|
}
|
||||||
|
public function facturas(Request $request, Response $response, $id_venta): Response {
|
||||||
|
$venta = Model::factory(Venta::class)->find_one($id_venta);
|
||||||
|
if (!$venta) {
|
||||||
|
return $this->withJson($response, ['venta' =>null, 'facturas' => null]);
|
||||||
|
}
|
||||||
|
$output = [
|
||||||
|
'venta' => $venta->as_array(),
|
||||||
|
'facturas' => null
|
||||||
|
];
|
||||||
|
if ($venta->facturas() !== null) {
|
||||||
|
$output['facturas'] = array_map(function($item) {
|
||||||
|
return $item->as_array();
|
||||||
|
}, $venta->facturas());
|
||||||
|
}
|
||||||
|
return $this->withJson($response, $output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ server {
|
|||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass backend:9000;
|
fastcgi_pass operadores-backend:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
@ -10,6 +10,7 @@ $app->group('/facturas', function($app) {
|
|||||||
});
|
});
|
||||||
$app->group('/factura/{id_factura}', function($app) {
|
$app->group('/factura/{id_factura}', function($app) {
|
||||||
$app->group('/ventas', function($app) {
|
$app->group('/ventas', function($app) {
|
||||||
|
$app->post('/add[/]', [Facturas::class, 'add_venta']);
|
||||||
$app->get('[/]', [Facturas::class, 'ventas']);
|
$app->get('[/]', [Facturas::class, 'ventas']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -8,5 +8,8 @@ $app->group('/venta/{id_venta}', function($app) {
|
|||||||
$app->group('/operador', function($app) {
|
$app->group('/operador', function($app) {
|
||||||
$app->get('[/]', [Ventas::class, 'operador']);
|
$app->get('[/]', [Ventas::class, 'operador']);
|
||||||
});
|
});
|
||||||
|
$app->group('/facturas', function($app) {
|
||||||
|
$app->get('[/]', [Ventas::class, 'facturas']);
|
||||||
|
});
|
||||||
$app->get('[/]', [Ventas::class, 'show']);
|
$app->get('[/]', [Ventas::class, 'show']);
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,7 @@ return [
|
|||||||
'engine' => 'mysql',
|
'engine' => 'mysql',
|
||||||
'name' => $_ENV['MYSQL_DATABASE'],
|
'name' => $_ENV['MYSQL_DATABASE'],
|
||||||
'host' => (object) [
|
'host' => (object) [
|
||||||
'name' => 'db'
|
'name' => $_ENV['MYSQL_HOST']
|
||||||
],
|
],
|
||||||
'user' => (object) [
|
'user' => (object) [
|
||||||
'name' => $_ENV['MYSQL_USER'],
|
'name' => $_ENV['MYSQL_USER'],
|
||||||
|
@ -83,6 +83,10 @@ class FacturaProyectoOperador extends Model {
|
|||||||
];
|
];
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
public function addVenta($data) {
|
||||||
|
$data['factura_id'] = $this->id;
|
||||||
|
return FacturaVenta::add($data);
|
||||||
|
}
|
||||||
|
|
||||||
public function as_array() {
|
public function as_array() {
|
||||||
$arr = parent::as_array();
|
$arr = parent::as_array();
|
||||||
|
@ -27,6 +27,37 @@ class FacturaVenta extends Model {
|
|||||||
return $this->venta;
|
return $this->venta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function add($data) {
|
||||||
|
$fields = [
|
||||||
|
'factura_id',
|
||||||
|
'venta_id',
|
||||||
|
'valor'
|
||||||
|
];
|
||||||
|
$input = array_intersect_key($data, array_combine($fields, $fields));
|
||||||
|
$validate = [
|
||||||
|
'factura_id',
|
||||||
|
'venta_id'
|
||||||
|
];
|
||||||
|
$orm = Model::factory(FacturaVenta::class);
|
||||||
|
foreach ($validate as $field) {
|
||||||
|
$orm = $orm->where($field, $input[$field]);
|
||||||
|
}
|
||||||
|
$factura = $orm->find_one();
|
||||||
|
$created = false;
|
||||||
|
$found = true;
|
||||||
|
if (!$factura) {
|
||||||
|
$found = false;
|
||||||
|
$factura = FacturaVenta::create($input);
|
||||||
|
$created = $factura->save();
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'input' => $input,
|
||||||
|
'factura' => $factura->as_array(),
|
||||||
|
'new' => !$found,
|
||||||
|
'created' => $created
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function as_array() {
|
public function as_array() {
|
||||||
$arr = parent::as_array();
|
$arr = parent::as_array();
|
||||||
$arr['factura'] = $this->factura()->as_array();
|
$arr['factura'] = $this->factura()->as_array();
|
||||||
|
@ -45,12 +45,10 @@ class Proyecto extends Model {
|
|||||||
public function operadores() {
|
public function operadores() {
|
||||||
if ($this->operadores === null) {
|
if ($this->operadores === null) {
|
||||||
$pas = $this->has_many(ProyectoAgente::class, 'proyecto')->find_many();
|
$pas = $this->has_many(ProyectoAgente::class, 'proyecto')->find_many();
|
||||||
$operadores = [];
|
$pas = array_filter($pas, function($pa) {
|
||||||
foreach ($pas as $pa) {
|
return ($pa->agente_tipo()->tipo() === 'operador');
|
||||||
$id = $pa->agente_tipo()->agente()->id;
|
});
|
||||||
$operadores []= Model::factory(Operador::class)->find_one($id);
|
$this->operadores = $pas;
|
||||||
}
|
|
||||||
$this->operadores = $operadores;
|
|
||||||
}
|
}
|
||||||
return $this->operadores;
|
return $this->operadores;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,4 @@ class Unidad extends Model {
|
|||||||
}
|
}
|
||||||
return $this->proyecto_tipo_unidad;
|
return $this->proyecto_tipo_unidad;
|
||||||
}
|
}
|
||||||
protected $facturas;
|
|
||||||
public function facturas() {
|
|
||||||
if ($this->facturas === null) {
|
|
||||||
$this->facturas = $this->has_many(FacturaUnidad::class, 'unidad_id')->find_many();
|
|
||||||
}
|
|
||||||
return $this->facturas;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -72,16 +72,26 @@ class Venta extends Model {
|
|||||||
}
|
}
|
||||||
return $this->comision;
|
return $this->comision;
|
||||||
}
|
}
|
||||||
|
protected $facturas;
|
||||||
|
public function facturas() {
|
||||||
|
if ($this->facturas === null) {
|
||||||
|
$this->facturas = $this->has_many(FacturaVenta::class, 'venta_id')->find_many();
|
||||||
|
}
|
||||||
|
return $this->facturas;
|
||||||
|
}
|
||||||
|
|
||||||
public function as_array() {
|
public function as_array() {
|
||||||
$arr = parent::as_array();
|
$arr = parent::as_array();
|
||||||
$arr['propietario'] = $this->propietario()->as_array();
|
$arr['propietario'] = $this->propietario()->as_array();
|
||||||
$arr['propiedad'] = $this->propiedad()->as_array();
|
$arr['propiedad'] = $this->propiedad()->as_array();
|
||||||
$arr['valor'] = '$ ' . number_format($this->valor_uf, 2, ',', '.');
|
$arr['valor'] = [
|
||||||
|
'valor' => $this->valor_uf,
|
||||||
|
'formateado' => number_format($this->valor_uf, 2, ',', '.') . ' UF'
|
||||||
|
];
|
||||||
if ($this->operador()) {
|
if ($this->operador()) {
|
||||||
$arr['operador'] = $this->operador()->as_array();
|
$arr['operador'] = $this->operador()->as_array();
|
||||||
$arr['comision'] = (array) $this->comision();
|
$arr['comision'] = (array) $this->comision();
|
||||||
$arr['comision']['formateada'] = '$ ' . number_format($this->comision()->total, 2, ',', '.');
|
$arr['comision']['formateada'] = number_format($this->comision()->total, 2, ',', '.') . ' UF';
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
@ -1,68 +1,83 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
backend-proxy:
|
operadores-backend-proxy:
|
||||||
container_name: backend_proxy
|
profiles:
|
||||||
|
- operadores
|
||||||
|
container_name: operadores_api
|
||||||
image: nginx
|
image: nginx
|
||||||
volumes:
|
volumes:
|
||||||
- ./api/:/app/
|
- ${OPERADORES_PATH:-.}/api/:/app/
|
||||||
- ./api/nginx.conf:/etc/nginx/conf.d/default.conf
|
- ${OPERADORES_PATH:-.}/api/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./logs/api/:/var/log/nginx/
|
- ./logs/operadores/api/:/var/log/nginx/
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 8081:80
|
- 8001:80
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- operadores-backend
|
||||||
backend:
|
operadores-backend:
|
||||||
container_name: backend
|
profiles:
|
||||||
|
- operadores
|
||||||
|
container_name: operadores_backend
|
||||||
|
restart: unless-stopped
|
||||||
image: php
|
image: php
|
||||||
build:
|
build:
|
||||||
context: ./api
|
context: ${OPERADROES_PATH:-.}/api
|
||||||
dockerfile: PHP.Dockerfile
|
dockerfile: PHP.Dockerfile
|
||||||
env_file: .db.env
|
env_file: ${OPERADORES_PATH:-.}/.db.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./api/:/app/
|
- ${OPERADORES_PATH:-.}/api/:/app/
|
||||||
depends_on:
|
# depends_on:
|
||||||
- db
|
# - db
|
||||||
|
|
||||||
frontend-proxy:
|
operadores-frontend-proxy:
|
||||||
container_name: frontend_proxy
|
profiles:
|
||||||
|
- operadores
|
||||||
|
container_name: operadores_ui
|
||||||
image: nginx
|
image: nginx
|
||||||
volumes:
|
volumes:
|
||||||
- ./ui/:/app/
|
- ${OPERADORES_PATH:-.}/ui/:/app/
|
||||||
- ./ui/nginx.conf:/etc/nginx/conf.d/default.conf
|
- ${OPERADORES_PATH:-.}/ui/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./logs/ui/:/var/log/nginx/
|
- ./logs/operadores/ui/:/var/log/nginx/
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 8080:80
|
- 8000:80
|
||||||
depends_on:
|
depends_on:
|
||||||
- frontend
|
- operadores-frontend
|
||||||
frontend:
|
operadores-frontend:
|
||||||
container_name: frontend
|
profiles:
|
||||||
|
- operadores
|
||||||
|
container_name: operadores_frontend
|
||||||
|
restart: unless-stopped
|
||||||
image: php:ui
|
image: php:ui
|
||||||
build:
|
build:
|
||||||
context: ./ui
|
context: ${OPERADORES_PATH:-.}/ui
|
||||||
dockerfile: PHP.Dockerfile
|
dockerfile: PHP.Dockerfile
|
||||||
env_file: .ui.env
|
env_file: ${OPERADORES_PATH:-.}/.ui.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./ui/:/app/
|
- ${OPERADORES_PATH:-.}/ui/:/app/
|
||||||
|
#
|
||||||
|
# db:
|
||||||
|
# image: mariadb
|
||||||
|
# volumes:
|
||||||
|
# - database:/var/lib/mysql
|
||||||
|
# env_file: .db.env
|
||||||
|
# adminer:
|
||||||
|
# image: adminer
|
||||||
|
# environment:
|
||||||
|
# ADMINER_PLUGINS: "dump-json edit-foreign enum-option json-column"
|
||||||
|
# ADMINER_DESIGN: "dracula"
|
||||||
|
# volumes:
|
||||||
|
# - ./adminer/plugins-enabled/:/var/www/html/plugins-enabled/
|
||||||
|
# ports:
|
||||||
|
# - 8082:8080
|
||||||
|
# depends_on:
|
||||||
|
# - db
|
||||||
|
#
|
||||||
|
#volumes:
|
||||||
|
# database:
|
||||||
|
|
||||||
db:
|
networks:
|
||||||
image: mariadb
|
default:
|
||||||
volumes:
|
external: true
|
||||||
- database:/var/lib/mysql
|
name: incoviba_network
|
||||||
env_file: .db.env
|
|
||||||
adminer:
|
|
||||||
image: adminer
|
|
||||||
environment:
|
|
||||||
ADMINER_PLUGINS: "dump-json edit-foreign enum-option json-column"
|
|
||||||
ADMINER_DESIGN: "dracula"
|
|
||||||
volumes:
|
|
||||||
- ./adminer/plugins-enabled/:/var/www/html/plugins-enabled/
|
|
||||||
ports:
|
|
||||||
- 8082:8080
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
database:
|
|
||||||
|
@ -13,7 +13,7 @@ server {
|
|||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass frontend:9000;
|
fastcgi_pass operadores-frontend:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
@ -328,6 +328,7 @@
|
|||||||
facturas.asignar($(e.target)).then(() => {
|
facturas.asignar($(e.target)).then(() => {
|
||||||
$(e.target).trigger('reset')
|
$(e.target).trigger('reset')
|
||||||
$(this.id).modal('toggle')
|
$(this.id).modal('toggle')
|
||||||
|
$(this.id).modal('hide')
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
@ -23,18 +23,26 @@
|
|||||||
@include('layout.menu.informes')
|
@include('layout.menu.informes')
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li rol="presentation" class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
|
Operadores <span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
@include('layout.menu.operadores')
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li role="presentation" class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
|
Operadores <span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
@include('layout.menu.operadores')
|
||||||
|
</li>
|
||||||
|
|
||||||
<li role="presentation" class="dropdown">
|
<li role="presentation" class="dropdown">
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
Herramientas <span class="caret"></span>
|
Herramientas <span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
@include('layout.menu.herramientas')
|
@include('layout.menu.herramientas')
|
||||||
</li>
|
</li>
|
||||||
<li rol="presentation" class="dropdown">
|
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
|
||||||
Operadores <span class="caret"></span>
|
|
||||||
</a>
|
|
||||||
@include('layout.menu.operadores')
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li role="presentation" class="dropdown">
|
<li role="presentation" class="dropdown">
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
<a href="{{$urls->base}}/ventas">Ventas</a>
|
<a href="{{$urls->base}}/ventas">Ventas</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{$urls->base}}/informe">Informe</a>
|
<a href="{{$urls->base}}/facturas">Informe</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -53,6 +53,60 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class Facturas {
|
||||||
|
constructor(venta_id) {
|
||||||
|
this.venta_id = venta_id
|
||||||
|
this.facturas = []
|
||||||
|
}
|
||||||
|
get() {
|
||||||
|
return $.ajax({
|
||||||
|
url: '{{$urls->api}}/venta/' + this.venta_id + '/facturas',
|
||||||
|
method: 'get',
|
||||||
|
dataType: 'json'
|
||||||
|
}).then((data) => {
|
||||||
|
if (data.facturas === null || data.facturas.length == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.facturas = data.facturas
|
||||||
|
this.draw()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
draw() {
|
||||||
|
const parent = $('#' + this.venta_id)
|
||||||
|
let tbody = parent.find('tbody')
|
||||||
|
if (tbody.length == 0) {
|
||||||
|
tbody = $('<tbody></tbody>')
|
||||||
|
const table = $('<table></table>').attr('class', 'table').append(
|
||||||
|
$('<thead></thead>').append(
|
||||||
|
$('<tr></tr>').append(
|
||||||
|
$('<th></th>').html('Factura')
|
||||||
|
).append(
|
||||||
|
$('<th></th>').html('Emisor')
|
||||||
|
).append(
|
||||||
|
$('<th></th>').html('Fecha')
|
||||||
|
).append(
|
||||||
|
$('<th></th>').html('Valor')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).append(tbody)
|
||||||
|
parent.append(table)
|
||||||
|
}
|
||||||
|
tbody.html('')
|
||||||
|
$.each(this.facturas, (i, el) => {
|
||||||
|
tbody.append(
|
||||||
|
$('<tr></tr>').append(
|
||||||
|
$('<td></td>').html(el.factura.factura)
|
||||||
|
).append(
|
||||||
|
$('<td></td>').html(el.factura.operador.descripcion)
|
||||||
|
).append(
|
||||||
|
$('<td></td>').html(el.factura.fecha.formateada)
|
||||||
|
).append(
|
||||||
|
$('<td></td>').html(el.valor.formateado)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
const ventas = {
|
const ventas = {
|
||||||
id: '#ventas',
|
id: '#ventas',
|
||||||
data: [],
|
data: [],
|
||||||
@ -69,9 +123,9 @@
|
|||||||
this.draw()
|
this.draw()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
facturas: (unidad) => {
|
facturas: (venta) => {
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: '{{$urls->api}}/unidad/' + unidad + '/facturas',
|
url: '{{$urls->api}}/venta/' + venta + '/facturas',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
})
|
})
|
||||||
@ -86,34 +140,26 @@
|
|||||||
).append(
|
).append(
|
||||||
$('<td></td>').html(el.propietario.nombre_completo)
|
$('<td></td>').html(el.propietario.nombre_completo)
|
||||||
).append(
|
).append(
|
||||||
$('<td></td>').attr('class', 'text-right').html(el.valor)
|
$('<td></td>').attr('class', 'text-right').html(el.valor.formateado)
|
||||||
)
|
)
|
||||||
if (el.operador) {
|
if (el.operador) {
|
||||||
row.append(
|
row.append(
|
||||||
$('<td></td>').html(el.operador.descripcion)
|
$('<td></td>').html(el.operador.descripcion)
|
||||||
).append(
|
).append(
|
||||||
$('<td></td>').attr('class', 'text-right').html(el.comision.formateada)
|
$('<td></td>').attr('class', 'text-right').html(el.comision.formateada)
|
||||||
).append(
|
|
||||||
$('<td></td>').attr('id', el.propiedad.unidades[0].id)
|
|
||||||
)
|
)
|
||||||
this.get().facturas(el.propiedad.unidades[0].id).then((data) => {
|
|
||||||
const td = $('td#' + data.unidad.id)
|
|
||||||
if (data.facturas === null || data.facturas.length == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$.each(data.facturas, (k, it) => {
|
|
||||||
console.debug(it)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
row.append(
|
row.append(
|
||||||
$('<td></td>')
|
$('<td></td>')
|
||||||
).append(
|
).append(
|
||||||
$('<td></td>')
|
$('<td></td>')
|
||||||
).append(
|
|
||||||
$('<td></td>')
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
row.append(
|
||||||
|
$('<td></td>').attr('id', el.id)
|
||||||
|
)
|
||||||
|
this.data[i].facturas = new Facturas(el.id)
|
||||||
|
this.data[i].facturas.get()
|
||||||
parent.append(row)
|
parent.append(row)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
|
'debug' => $_ENV['DEBUG'],
|
||||||
'folders' => function() {
|
'folders' => function() {
|
||||||
$arr = ['base' => dirname(__DIR__, 2)];
|
$arr = ['base' => dirname(__DIR__, 2)];
|
||||||
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
Reference in New Issue
Block a user