Creando orden de compra y aceptandolas
Esta por terminar la funcionalidad
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -16,7 +16,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
99
COSAS_POR_ARREGLAR.md
Normal file
99
COSAS_POR_ARREGLAR.md
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
#Cosas que quiero arreglar, pero no podre
|
||||||
|
|
||||||
|
## Validaciones
|
||||||
|
|
||||||
|
Las validaciones encuentro que me quedaron bien, sin embargo creo que pueden ser mucho mejor,
|
||||||
|
el problema es que no encontre ninguna libreria que no trabaje con web o con objetos ya creados.
|
||||||
|
|
||||||
|
Mi idea de una buena libreria de validaciones es algo similar a la que utiliza laravel,
|
||||||
|
se pasa un objeto y una serie de reglas a aplicar a ese objeto, si alguna de las reglas falla, la
|
||||||
|
validacion completa fallara.
|
||||||
|
|
||||||
|
Estuve jugando un poco con la idea de hacer algo similar, pero no logre hacer que las reglas fueran
|
||||||
|
universales, para poder arreglar esto puede que me hubiese tomado mucho tiempo asi que decidi volver a
|
||||||
|
como estan en este momento.
|
||||||
|
|
||||||
|
Basicamente mi idea de una validacion tendria que tener un codigo como este:
|
||||||
|
|
||||||
|
```
|
||||||
|
Validation validacion = new Validation(
|
||||||
|
object.getA() => List.of(Rule.notNull(), Rule.string(), Rule.minLength(5)),
|
||||||
|
object.getB() => List.of(Rule.date)
|
||||||
|
).validate();
|
||||||
|
|
||||||
|
if(validation.hasError()) {
|
||||||
|
validation.showErrorDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Sin embargo no sabria como hacer un map al momento de inicializar un objeto (porque el => no existe en java),
|
||||||
|
podria crearlo y poblarlo antes, pero no quiero escribir tanto codigo y siento que quedaria sucio
|
||||||
|
dentro de un controlador.
|
||||||
|
|
||||||
|
# BaseTableModel
|
||||||
|
|
||||||
|
Me gusta esa parte de mi codigo, me deja bastante facil el crear un tabla bonita a la que solo le paso
|
||||||
|
un objeto y con las reglas que le asigno al inicializar los muestra correctamente, me ahorro el estar
|
||||||
|
transformando a strings en el controlador y cosas asi.
|
||||||
|
|
||||||
|
Sin embargo creo que podria ser mas limpio
|
||||||
|
|
||||||
|
```
|
||||||
|
this.model = new BaseTableModel<>(
|
||||||
|
new String[]{"Distribuidor", "Nº Libros", "Estado", "Fecha Emision"},
|
||||||
|
(row, rowIndex, colIndex) -> {
|
||||||
|
switch (colIndex) {
|
||||||
|
case 0:
|
||||||
|
return row.get(rowIndex).getDistribuidor().getRut();
|
||||||
|
case 1:
|
||||||
|
return row.get(rowIndex).getLibros().size();
|
||||||
|
case 2:
|
||||||
|
return row.get(rowIndex).getEstado();
|
||||||
|
case 3:
|
||||||
|
return row.get(rowIndex).getInsertedAt();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
Como se ve, cada vez tengo que obtener el objeto y luego obtener la parte que quiero mostrar.
|
||||||
|
Seguramente es facil dejarlo mas bonito, pero tendria que cambiar todas las vistas que usan una tabla,
|
||||||
|
me tomaria un rato quizas un poco largo y no quiero perderlo.
|
||||||
|
|
||||||
|
## LaunchController
|
||||||
|
|
||||||
|
Me gusta como queda, pero siento que igual se podria hacer algo mejor.
|
||||||
|
|
||||||
|
Seria perfecto que cada vista se pudiera autoinsertar de alguna forma en ese controlador, en vez de estar
|
||||||
|
llamando a cada una y creandola manualmente
|
||||||
|
|
||||||
|
Quizas puede hacerse de alguna forma con funciones estaticas? o alguna especie de singleton? como todos
|
||||||
|
los controladores existen solo una vez dentro de la aplicacion quizas es viable
|
||||||
|
Cosa que se pueda hacer lo siguiente
|
||||||
|
|
||||||
|
```
|
||||||
|
class Controller {
|
||||||
|
private View view;
|
||||||
|
|
||||||
|
// Constructor estatico
|
||||||
|
{
|
||||||
|
LaunchController.add(new Controller(new View()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Controller(View view) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToView2() {
|
||||||
|
LaunchController.show(PanelName.View2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
No estoy seguro si seria viable, pero pareciera ser una buena solucion, ahora no la puedo implementar porque
|
||||||
|
significaria crear toda la arquitectura de la app desde cero.
|
||||||
|
|
||||||
|
No hay tiempo :c
|
||||||
BIN
biblioteca.vpp
BIN
biblioteca.vpp
Binary file not shown.
20
create.sql
20
create.sql
@@ -32,6 +32,7 @@ drop table if exists cliente_correo;
|
|||||||
drop table if exists trabajador_direccion;
|
drop table if exists trabajador_direccion;
|
||||||
drop table if exists trabajador_telefono;
|
drop table if exists trabajador_telefono;
|
||||||
drop table if exists trabajador_correo;
|
drop table if exists trabajador_correo;
|
||||||
|
drop table if exists orden_compra;
|
||||||
drop table if exists factura;
|
drop table if exists factura;
|
||||||
drop table if exists boleta;
|
drop table if exists boleta;
|
||||||
drop table if exists compra;
|
drop table if exists compra;
|
||||||
@@ -292,6 +293,17 @@ create table boleta
|
|||||||
inserted_at timestamp default CURRENT_TIMESTAMP
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table orden_compra
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
estado enum ('En Curso', 'Aceptada', 'Cancelada'),
|
||||||
|
compra_id int unsigned,
|
||||||
|
distribuidor_id int unsigned not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade,
|
||||||
|
foreign key (compra_id) references compra (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
create table compra
|
create table compra
|
||||||
(
|
(
|
||||||
id int unsigned primary key auto_increment,
|
id int unsigned primary key auto_increment,
|
||||||
@@ -329,6 +341,14 @@ create table arriendo
|
|||||||
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table libro_orden_compra
|
||||||
|
(
|
||||||
|
libro_id int unsigned,
|
||||||
|
orden_compra_id int unsigned,
|
||||||
|
foreign key (libro_id) references libro (id) on delete restrict on update cascade,
|
||||||
|
foreign key (orden_compra_id) references orden_compra (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
create table ejemplar_compra
|
create table ejemplar_compra
|
||||||
(
|
(
|
||||||
ejemplar_id int unsigned,
|
ejemplar_id int unsigned,
|
||||||
|
|||||||
504
mysql
Normal file
504
mysql
Normal file
@@ -0,0 +1,504 @@
|
|||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
#-----------------------------Eliminar todas las tablas--------------------------#
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
start transaction;
|
||||||
|
|
||||||
|
set foreign_key_checks = 0;
|
||||||
|
set autocommit = 0;
|
||||||
|
|
||||||
|
drop table if exists editorial;
|
||||||
|
drop table if exists estado;
|
||||||
|
drop table if exists autor;
|
||||||
|
drop table if exists categoria;
|
||||||
|
drop table if exists idioma;
|
||||||
|
drop table if exists libro;
|
||||||
|
drop table if exists ejemplar;
|
||||||
|
drop table if exists libro_autor;
|
||||||
|
drop table if exists libro_categoria;
|
||||||
|
drop table if exists libro_idioma;
|
||||||
|
drop table if exists correo;
|
||||||
|
drop table if exists direccion;
|
||||||
|
drop table if exists telefono;
|
||||||
|
drop table if exists empresa;
|
||||||
|
drop table if exists distribuidor;
|
||||||
|
drop table if exists cliente;
|
||||||
|
drop table if exists trabajador;
|
||||||
|
drop table if exists distribuidor_direccion;
|
||||||
|
drop table if exists distribuidor_telefono;
|
||||||
|
drop table if exists distribuidor_correo;
|
||||||
|
drop table if exists cliente_direccion;
|
||||||
|
drop table if exists cliente_telefono;
|
||||||
|
drop table if exists cliente_correo;
|
||||||
|
drop table if exists trabajador_direccion;
|
||||||
|
drop table if exists trabajador_telefono;
|
||||||
|
drop table if exists trabajador_correo;
|
||||||
|
drop table if exists orden_compra;
|
||||||
|
drop table if exists factura;
|
||||||
|
drop table if exists boleta;
|
||||||
|
drop table if exists compra;
|
||||||
|
drop table if exists venta;
|
||||||
|
drop table if exists arriendo;
|
||||||
|
drop table if exists ejemplar_compra;
|
||||||
|
drop table if exists ejemplar_venta;
|
||||||
|
drop table if exists ejemplar_arriendo;
|
||||||
|
drop table if exists usuario;
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
#--------------Definicion de las tablas relacionadas a los libros----------------#
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
create table editorial
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table estado
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table autor
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
apellido_paterno varchar(255) null,
|
||||||
|
apellido_materno varchar(255) null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table categoria
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table idioma
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table libro
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
editorial_id int unsigned not null,
|
||||||
|
isbn varchar(255) not null,
|
||||||
|
ano_publicacion int default null,
|
||||||
|
numero_paginas int not null,
|
||||||
|
titulo varchar(255) default null,
|
||||||
|
precio_referencia int not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (editorial_id) references editorial (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table ejemplar
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
libro_id int unsigned not null,
|
||||||
|
estado_id int unsigned default 1,
|
||||||
|
serie varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
unique key serie_libro (serie, libro_id),
|
||||||
|
foreign key (libro_id) references libro (id) on delete cascade on update cascade,
|
||||||
|
foreign key (estado_id) references estado (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table libro_autor
|
||||||
|
(
|
||||||
|
libro_id int unsigned not null,
|
||||||
|
autor_id int unsigned not null,
|
||||||
|
foreign key (libro_id) references libro (id) on delete restrict on update cascade,
|
||||||
|
foreign key (autor_id) references autor (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table libro_categoria
|
||||||
|
(
|
||||||
|
libro_id int unsigned not null,
|
||||||
|
categoria_id int unsigned not null,
|
||||||
|
foreign key (libro_id) references libro (id) on delete restrict on update cascade,
|
||||||
|
foreign key (categoria_id) references categoria (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table libro_idioma
|
||||||
|
(
|
||||||
|
libro_id int unsigned not null,
|
||||||
|
idioma_id int unsigned not null,
|
||||||
|
foreign key (libro_id) references libro (id) on delete restrict on update cascade,
|
||||||
|
foreign key (idioma_id) references idioma (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
#------------Definicion de las tablas relacionadas a las personas----------------#
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
create table direccion
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
calle varchar(255) not null,
|
||||||
|
numero varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table telefono
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
numero varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table correo
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
correo varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table empresa
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table distribuidor
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
empresa_id int unsigned not null,
|
||||||
|
rut varchar(255) not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (empresa_id) references empresa (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table cliente
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
rut varchar(255) not null,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
apellido_paterno varchar(255) not null,
|
||||||
|
apellido_materno varchar(255) not null,
|
||||||
|
fecha_nacimiento date not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table trabajador
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
rut varchar(255) not null,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
apellido_paterno varchar(255) not null,
|
||||||
|
apellido_materno varchar(255) not null,
|
||||||
|
fecha_contrato date not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table distribuidor_direccion
|
||||||
|
(
|
||||||
|
distribuidor_id int unsigned,
|
||||||
|
direccion_id int unsigned,
|
||||||
|
foreign key (distribuidor_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (direccion_id) references direccion (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table distribuidor_telefono
|
||||||
|
(
|
||||||
|
distribuidor_id int unsigned,
|
||||||
|
telefono_id int unsigned,
|
||||||
|
foreign key (distribuidor_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (telefono_id) references telefono (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table distribuidor_correo
|
||||||
|
(
|
||||||
|
distribuidor_id int unsigned,
|
||||||
|
correo_id int unsigned,
|
||||||
|
foreign key (distribuidor_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (correo_id) references correo (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table cliente_direccion
|
||||||
|
(
|
||||||
|
cliente_id int unsigned,
|
||||||
|
direccion_id int unsigned,
|
||||||
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (direccion_id) references direccion (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table cliente_telefono
|
||||||
|
(
|
||||||
|
cliente_id int unsigned,
|
||||||
|
telefono_id int unsigned,
|
||||||
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (telefono_id) references telefono (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table cliente_correo
|
||||||
|
(
|
||||||
|
cliente_id int unsigned,
|
||||||
|
correo_id int unsigned,
|
||||||
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (correo_id) references correo (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table trabajador_direccion
|
||||||
|
(
|
||||||
|
trabajador_id int unsigned,
|
||||||
|
direccion_id int unsigned,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade,
|
||||||
|
foreign key (direccion_id) references direccion (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table trabajador_telefono
|
||||||
|
(
|
||||||
|
trabajador_id int unsigned,
|
||||||
|
telefono_id int unsigned,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade,
|
||||||
|
foreign key (telefono_id) references telefono (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table trabajador_correo
|
||||||
|
(
|
||||||
|
trabajador_id int unsigned,
|
||||||
|
correo_id int unsigned,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade,
|
||||||
|
foreign key (correo_id) references correo (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
#-------Definicion de las tablas relacionadas a la venta/compra/arriendo---------#
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
create table factura
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
folio varchar(255) not null,
|
||||||
|
precio_neto int not null,
|
||||||
|
precio_iva int not null,
|
||||||
|
fecha_compra datetime not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table boleta
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
folio varchar(255) not null,
|
||||||
|
precio_neto int not null,
|
||||||
|
precio_iva int not null,
|
||||||
|
fecha_venta datetime not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table orden_compra
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
estado enum ('En Curso', 'Aceptada', 'Cancelada'),
|
||||||
|
compra_id int unsigned,
|
||||||
|
distribuidor_id int unsigned not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade,
|
||||||
|
foreign key (compra_id) references compra (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table compra
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
factura_id int unsigned not null,
|
||||||
|
distribuidor_id int unsigned not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (factura_id) references factura (id) on delete restrict on update cascade,
|
||||||
|
foreign key (distribuidor_id) references cliente (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table venta
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
cliente_id int unsigned not null,
|
||||||
|
trabajador_id int unsigned not null,
|
||||||
|
boleta_id int unsigned not null,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade,
|
||||||
|
foreign key (boleta_id) references boleta (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arriendo
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
trabajador_id int unsigned not null,
|
||||||
|
cliente_id int unsigned not null,
|
||||||
|
costo_arriendo int not null,
|
||||||
|
fecha_arriendo date not null,
|
||||||
|
fecha_devolucion_estimada date not null,
|
||||||
|
fecha_devolucion_real date,
|
||||||
|
multa int,
|
||||||
|
inserted_at timestamp default CURRENT_TIMESTAMP,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade,
|
||||||
|
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table ejemplar_compra
|
||||||
|
(
|
||||||
|
ejemplar_id int unsigned,
|
||||||
|
compra_id int unsigned,
|
||||||
|
foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
|
||||||
|
foreign key (compra_id) references compra (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table ejemplar_venta
|
||||||
|
(
|
||||||
|
ejemplar_id int unsigned,
|
||||||
|
venta_id int unsigned,
|
||||||
|
foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
|
||||||
|
foreign key (venta_id) references venta (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table ejemplar_arriendo
|
||||||
|
(
|
||||||
|
ejemplar_id int unsigned,
|
||||||
|
arriendo_id int unsigned,
|
||||||
|
foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
|
||||||
|
foreign key (arriendo_id) references arriendo (id) on delete restrict on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
#---------------------Definicion de las tablas de usuario------------------------#
|
||||||
|
#--------------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
create table usuario
|
||||||
|
(
|
||||||
|
id int unsigned primary key auto_increment,
|
||||||
|
nombre varchar(255) not null,
|
||||||
|
password binary(32) not null,
|
||||||
|
salt binary(16) not null,
|
||||||
|
trabajador_id int unsigned not null,
|
||||||
|
inserted_at timestamp default current_timestamp,
|
||||||
|
foreign key (trabajador_id) references trabajador (id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
set autocommit = 1;
|
||||||
|
set foreign_key_checks = 1;
|
||||||
|
|
||||||
|
commit;start transaction;
|
||||||
|
|
||||||
|
set foreign_key_checks = 0;
|
||||||
|
set autocommit = 0;
|
||||||
|
|
||||||
|
INSERT INTO `autor`
|
||||||
|
VALUES (1, 'Howard Philips', 'Lovecraft', NULL, '2019-06-12 16:18:57'),
|
||||||
|
(2, 'Stephen', 'King', NULL, '2019-06-12 16:18:57'),
|
||||||
|
(3, 'Brandon', 'Sanderson', NULL, '2019-06-12 16:18:57');
|
||||||
|
|
||||||
|
INSERT INTO `categoria`
|
||||||
|
VALUES (1, 'Terror', '2019-06-12 16:18:57'),
|
||||||
|
(2, 'Aventura', '2019-06-12 16:18:57'),
|
||||||
|
(3, 'Fantasia', '2019-06-12 16:18:57');
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `cliente`
|
||||||
|
VALUES (1, '21786653-7', 'Cliente', '1', '1', '2019-06-17', '2019-06-13 16:01:33'),
|
||||||
|
(2, '17181388-3', 'Cliente', '2', '2', '2019-06-13', '2019-06-13 16:04:02');
|
||||||
|
|
||||||
|
INSERT INTO `correo`
|
||||||
|
VALUES (1, 'HOOLA', '2019-06-13 17:25:41'),
|
||||||
|
(2, 'skrd159@gmail.com', '2019-06-13 17:32:13');
|
||||||
|
|
||||||
|
INSERT INTO `distribuidor`
|
||||||
|
VALUES (2, 1, '14166920-6', '2019-06-13 03:08:17'),
|
||||||
|
(3, 2, '8425080-5', '2019-06-13 03:08:23'),
|
||||||
|
(4, 1, '21629388-6', '2019-06-13 03:08:25'),
|
||||||
|
(5, 1, '13510176-1', '2019-06-13 03:08:27');
|
||||||
|
|
||||||
|
INSERT INTO `editorial`
|
||||||
|
VALUES (1, 'Editorial N1', '2019-06-12 16:18:57'),
|
||||||
|
(2, 'Editorial N2', '2019-06-12 16:18:57'),
|
||||||
|
(3, 'Editorial N3', '2019-06-12 16:18:57');
|
||||||
|
|
||||||
|
INSERT INTO `empresa`
|
||||||
|
VALUES (1, 'Empresa 1', '2019-06-13 00:39:50'),
|
||||||
|
(2, 'Empresa 2', '2019-06-13 00:39:52');
|
||||||
|
|
||||||
|
INSERT INTO `estado`
|
||||||
|
VALUES (1, 'Vendido', '2019-06-12 16:18:57'),
|
||||||
|
(2, 'Arrendado', '2019-06-12 16:18:57'),
|
||||||
|
(3, 'Disponible', '2019-06-12 16:18:57');
|
||||||
|
|
||||||
|
INSERT INTO `idioma`
|
||||||
|
VALUES (1, 'Español', '2019-06-12 16:18:57'),
|
||||||
|
(2, 'Ingles', '2019-06-12 16:18:57'),
|
||||||
|
(3, 'Portuges', '2019-06-12 16:18:57'),
|
||||||
|
(4, 'Aleman', '2019-06-12 16:18:57'),
|
||||||
|
(5, 'Ruso', '2019-06-12 16:18:57'),
|
||||||
|
(6, 'Japones', '2019-06-12 16:18:57');
|
||||||
|
|
||||||
|
INSERT INTO `libro`
|
||||||
|
VALUES (1, 1, '0-765-31178-X', 2006, 541, 'Mistborn: The Final Empire', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(2, 1, '0-765-31688-9', 2007, 590, 'Mistborn: The Well of Ascension', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(3, 1, '978-0-7653-1689-9', 2008, 572, 'Mistborn: The Hero of Ages', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(4, 2, '1231231231232', 1931, 100, 'The Shadow over Innsmouth', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(5, 2, '1231231231232', 1933, 100, 'The Dreams in the Witch House', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(6, 2, '1231231231232', 1936, 100, 'At the Mountains of Madness', 10000,
|
||||||
|
'2019-06-12 16:18:57'),
|
||||||
|
(7, 3, '0385086954', 1974, 199, 'Carrie', 10000, '2019-06-12 16:18:57'),
|
||||||
|
(8, 3, '978-0-670-26077-5', 1979, 428, 'The Dead Zone', 10000, '2019-06-12 16:18:57'),
|
||||||
|
(9, 3, '0-670-81302-8', 1986, 1138, 'It', 10000, '2019-06-12 16:18:57');
|
||||||
|
|
||||||
|
INSERT INTO `libro_autor`
|
||||||
|
VALUES (1, 3),
|
||||||
|
(2, 3),
|
||||||
|
(3, 3),
|
||||||
|
(4, 1),
|
||||||
|
(5, 1),
|
||||||
|
(6, 1),
|
||||||
|
(7, 2),
|
||||||
|
(8, 2),
|
||||||
|
(9, 2);
|
||||||
|
|
||||||
|
INSERT INTO `libro_categoria`
|
||||||
|
VALUES (1, 3),
|
||||||
|
(2, 3),
|
||||||
|
(3, 3),
|
||||||
|
(4, 1),
|
||||||
|
(5, 1),
|
||||||
|
(6, 1),
|
||||||
|
(7, 1),
|
||||||
|
(8, 1),
|
||||||
|
(9, 1);
|
||||||
|
|
||||||
|
INSERT INTO `libro_idioma`
|
||||||
|
VALUES (1, 2),
|
||||||
|
(2, 2),
|
||||||
|
(3, 2),
|
||||||
|
(4, 2),
|
||||||
|
(5, 2),
|
||||||
|
(6, 2),
|
||||||
|
(7, 2),
|
||||||
|
(8, 2),
|
||||||
|
(9, 2);
|
||||||
|
|
||||||
|
INSERT INTO `trabajador`
|
||||||
|
VALUES (2, '19763899-0', 'Daniel', 'Cortes', 'Pincheira', '2019-06-13', '2019-06-13 16:04:42'),
|
||||||
|
(3, '10768789-0', 'Trabajador', 'N', '2', '2019-06-13', '2019-06-13 16:05:17'),
|
||||||
|
(4, '9717478-4', 'Trabajador', 'N', '3', '2019-06-13', '2019-06-13 16:05:27');
|
||||||
|
|
||||||
|
INSERT INTO `trabajador_correo`
|
||||||
|
VALUES (4, 1),
|
||||||
|
(2, 2);
|
||||||
|
|
||||||
|
INSERT INTO `usuario`
|
||||||
|
VALUES (2, 'admin', 0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27,
|
||||||
|
0x3564ECCCD85CF0583F9C090602E998B7, 2, '2019-06-13 16:04:53');
|
||||||
|
|
||||||
|
set autocommit = 1;
|
||||||
|
set foreign_key_checks = 1;
|
||||||
|
|
||||||
|
commit;
|
||||||
@@ -30,9 +30,6 @@ import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoCreateContro
|
|||||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoSearchController;
|
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoSearchController;
|
||||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoUpdateController;
|
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoUpdateController;
|
||||||
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoViewController;
|
import xyz.danielcortes.controllers.cliente.telefono.ClienteTelefonoViewController;
|
||||||
import xyz.danielcortes.controllers.comprar.ComprarComprarController;
|
|
||||||
import xyz.danielcortes.controllers.comprar.ComprarSearchController;
|
|
||||||
import xyz.danielcortes.controllers.comprar.ComprarSeleccionarController;
|
|
||||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorCreateController;
|
import xyz.danielcortes.controllers.distribuidor.DistribuidorCreateController;
|
||||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorSearchController;
|
import xyz.danielcortes.controllers.distribuidor.DistribuidorSearchController;
|
||||||
import xyz.danielcortes.controllers.distribuidor.DistribuidorUpdateController;
|
import xyz.danielcortes.controllers.distribuidor.DistribuidorUpdateController;
|
||||||
@@ -65,6 +62,10 @@ import xyz.danielcortes.controllers.libro.LibroCreateController;
|
|||||||
import xyz.danielcortes.controllers.libro.LibroSearchController;
|
import xyz.danielcortes.controllers.libro.LibroSearchController;
|
||||||
import xyz.danielcortes.controllers.libro.LibroUpdateController;
|
import xyz.danielcortes.controllers.libro.LibroUpdateController;
|
||||||
import xyz.danielcortes.controllers.libro.LibroViewController;
|
import xyz.danielcortes.controllers.libro.LibroViewController;
|
||||||
|
import xyz.danielcortes.controllers.orden_compra.OrdenCompraAceptarController;
|
||||||
|
import xyz.danielcortes.controllers.orden_compra.OrdenCompraCrearController;
|
||||||
|
import xyz.danielcortes.controllers.orden_compra.OrdenCompraSearchController;
|
||||||
|
import xyz.danielcortes.controllers.orden_compra.OrdenCompraViewController;
|
||||||
import xyz.danielcortes.controllers.trabajador.TrabajadorCreateController;
|
import xyz.danielcortes.controllers.trabajador.TrabajadorCreateController;
|
||||||
import xyz.danielcortes.controllers.trabajador.TrabajadorSearchController;
|
import xyz.danielcortes.controllers.trabajador.TrabajadorSearchController;
|
||||||
import xyz.danielcortes.controllers.trabajador.TrabajadorUpdateController;
|
import xyz.danielcortes.controllers.trabajador.TrabajadorUpdateController;
|
||||||
@@ -100,9 +101,6 @@ import xyz.danielcortes.views.cliente.ClienteCreatePanel;
|
|||||||
import xyz.danielcortes.views.cliente.ClienteSearchPanel;
|
import xyz.danielcortes.views.cliente.ClienteSearchPanel;
|
||||||
import xyz.danielcortes.views.cliente.ClienteUpdatePanel;
|
import xyz.danielcortes.views.cliente.ClienteUpdatePanel;
|
||||||
import xyz.danielcortes.views.cliente.ClienteViewPanel;
|
import xyz.danielcortes.views.cliente.ClienteViewPanel;
|
||||||
import xyz.danielcortes.views.comprar.ComprarComprarPanel;
|
|
||||||
import xyz.danielcortes.views.comprar.ComprarSearchPanel;
|
|
||||||
import xyz.danielcortes.views.comprar.ComprarSeleccionarPanel;
|
|
||||||
import xyz.danielcortes.views.correo.CorreoCreatePanel;
|
import xyz.danielcortes.views.correo.CorreoCreatePanel;
|
||||||
import xyz.danielcortes.views.correo.CorreoSearchPanel;
|
import xyz.danielcortes.views.correo.CorreoSearchPanel;
|
||||||
import xyz.danielcortes.views.correo.CorreoUpdatePanel;
|
import xyz.danielcortes.views.correo.CorreoUpdatePanel;
|
||||||
@@ -131,6 +129,10 @@ import xyz.danielcortes.views.libro.LibroCreatePanel;
|
|||||||
import xyz.danielcortes.views.libro.LibroSearchPanel;
|
import xyz.danielcortes.views.libro.LibroSearchPanel;
|
||||||
import xyz.danielcortes.views.libro.LibroUpdatePanel;
|
import xyz.danielcortes.views.libro.LibroUpdatePanel;
|
||||||
import xyz.danielcortes.views.libro.LibroViewPanel;
|
import xyz.danielcortes.views.libro.LibroViewPanel;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraAceptarPanel;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraCrearPanel;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraSearchPanel;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraViewPanel;
|
||||||
import xyz.danielcortes.views.telefono.TelefonoCreatePanel;
|
import xyz.danielcortes.views.telefono.TelefonoCreatePanel;
|
||||||
import xyz.danielcortes.views.telefono.TelefonoSearchPanel;
|
import xyz.danielcortes.views.telefono.TelefonoSearchPanel;
|
||||||
import xyz.danielcortes.views.telefono.TelefonoUpdatePanel;
|
import xyz.danielcortes.views.telefono.TelefonoUpdatePanel;
|
||||||
@@ -292,9 +294,10 @@ public class LaunchController {
|
|||||||
this.controllers.put(PanelName.DISTRIBUIDOR_DIRECCION_CREATE, new DistribuidorDireccionCreateController(new DireccionCreatePanel(), this));
|
this.controllers.put(PanelName.DISTRIBUIDOR_DIRECCION_CREATE, new DistribuidorDireccionCreateController(new DireccionCreatePanel(), this));
|
||||||
this.controllers.put(PanelName.DISTRIBUIDOR_DIRECCION_UPDATE, new DistribuidorDireccionUpdateController(new DireccionUpdatePanel(), this));
|
this.controllers.put(PanelName.DISTRIBUIDOR_DIRECCION_UPDATE, new DistribuidorDireccionUpdateController(new DireccionUpdatePanel(), this));
|
||||||
|
|
||||||
this.controllers.put(PanelName.COMPRAR_SEARCH, new ComprarSearchController(new ComprarSearchPanel(), this));
|
this.controllers.put(PanelName.ORDEN_COMPRA_SEARCH, new OrdenCompraSearchController(new OrdenCompraSearchPanel(), this));
|
||||||
this.controllers.put(PanelName.COMPRAR_COMPRAR, new ComprarComprarController(new ComprarComprarPanel(), this));
|
this.controllers.put(PanelName.ORDEN_COMPRA_CREAR, new OrdenCompraCrearController(new OrdenCompraCrearPanel(), this));
|
||||||
this.controllers.put(PanelName.COMPRAR_SELECCIONAR, new ComprarSeleccionarController(new ComprarSeleccionarPanel(), this));
|
this.controllers.put(PanelName.ORDEN_COMPRA_VIEW, new OrdenCompraViewController(new OrdenCompraViewPanel(), this));
|
||||||
|
this.controllers.put(PanelName.ORDEN_COMPRA_ACEPTAR, new OrdenCompraAceptarController(new OrdenCompraAceptarPanel(), this));
|
||||||
|
|
||||||
for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) {
|
for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) {
|
||||||
this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey());
|
this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey());
|
||||||
@@ -362,17 +365,17 @@ public class LaunchController {
|
|||||||
private JMenu createComprarMenu() {
|
private JMenu createComprarMenu() {
|
||||||
JMenu comprarMenu = new JMenu("Compra, Venta y Arriendo");
|
JMenu comprarMenu = new JMenu("Compra, Venta y Arriendo");
|
||||||
|
|
||||||
JMenuItem comprarLibroItem = new JMenuItem("Comprar Libro");
|
JMenuItem ordenDeCompraItem = new JMenuItem("Orden de compra");
|
||||||
JMenuItem venderLibroItem = new JMenuItem("Vender Libro");
|
JMenuItem venderEjemplarItem = new JMenuItem("Vender Ejemplar");
|
||||||
JMenuItem arrendarLibroItem = new JMenuItem("Arrendar Libro");
|
JMenuItem arrendarEjemplarItem = new JMenuItem("Arrendar Ejemplar");
|
||||||
|
|
||||||
comprarLibroItem.addActionListener(e -> this.showCard(PanelName.COMPRAR_SEARCH));
|
ordenDeCompraItem.addActionListener(e -> this.showCard(PanelName.ORDEN_COMPRA_SEARCH));
|
||||||
venderLibroItem.addActionListener(e -> this.showCard(PanelName.VENDER_SEARCH));
|
venderEjemplarItem.addActionListener(e -> this.showCard(PanelName.VENDER_SEARCH));
|
||||||
arrendarLibroItem.addActionListener(e -> this.showCard(PanelName.ARRENDAR_SEARCH));
|
arrendarEjemplarItem.addActionListener(e -> this.showCard(PanelName.ARRENDAR_SEARCH));
|
||||||
|
|
||||||
comprarMenu.add(comprarLibroItem);
|
comprarMenu.add(ordenDeCompraItem);
|
||||||
comprarMenu.add(venderLibroItem);
|
comprarMenu.add(venderEjemplarItem);
|
||||||
comprarMenu.add(arrendarLibroItem);
|
comprarMenu.add(arrendarEjemplarItem);
|
||||||
|
|
||||||
return comprarMenu;
|
return comprarMenu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
package xyz.danielcortes.controllers.comprar;
|
|
||||||
|
|
||||||
import xyz.danielcortes.controllers.LaunchController;
|
|
||||||
import xyz.danielcortes.framework.BaseController;
|
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
|
||||||
import xyz.danielcortes.framework.PanelName;
|
|
||||||
import xyz.danielcortes.repository.CompraRepository;
|
|
||||||
import xyz.danielcortes.repository.DistribuidorRepository;
|
|
||||||
import xyz.danielcortes.validator.CompraValidator;
|
|
||||||
import xyz.danielcortes.views.comprar.ComprarComprarPanel;
|
|
||||||
|
|
||||||
public class ComprarComprarController extends BaseController {
|
|
||||||
|
|
||||||
private ComprarComprarPanel view;
|
|
||||||
private CompraRepository compraRepository;
|
|
||||||
private DistribuidorRepository distribuidorRepository;
|
|
||||||
private CompraValidator validator;
|
|
||||||
|
|
||||||
public ComprarComprarController(ComprarComprarPanel view, LaunchController parent) {
|
|
||||||
super(parent);
|
|
||||||
this.view = view;
|
|
||||||
this.compraRepository = new CompraRepository();
|
|
||||||
this.distribuidorRepository = new DistribuidorRepository();
|
|
||||||
this.validator = new CompraValidator(this.compraRepository);
|
|
||||||
this.setupListeners();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupListeners() {
|
|
||||||
this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.COMPRAR_SEARCH));
|
|
||||||
this.view.getSeleccionarButton().addActionListener(e -> this.parentController.showCard(PanelName.COMPRAR_SELECCIONAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
this.fillDistribuidores();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillDistribuidores() {
|
|
||||||
this.view.getDistribuidorModel().removeAllElements();
|
|
||||||
this.view.getDistribuidorModel().addAll(this.distribuidorRepository.getAll());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BasePanel getView() {
|
|
||||||
return this.view;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
package xyz.danielcortes.controllers.comprar;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import xyz.danielcortes.controllers.LaunchController;
|
|
||||||
import xyz.danielcortes.framework.BaseController;
|
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
|
||||||
import xyz.danielcortes.framework.BaseTableModel;
|
|
||||||
import xyz.danielcortes.framework.PanelName;
|
|
||||||
import xyz.danielcortes.models.Compra;
|
|
||||||
import xyz.danielcortes.repository.CompraRepository;
|
|
||||||
import xyz.danielcortes.validator.CompraValidator;
|
|
||||||
import xyz.danielcortes.views.comprar.ComprarSearchPanel;
|
|
||||||
|
|
||||||
public class ComprarSearchController extends BaseController {
|
|
||||||
|
|
||||||
private ComprarSearchPanel view;
|
|
||||||
private CompraRepository repository;
|
|
||||||
private CompraValidator validator;
|
|
||||||
|
|
||||||
public ComprarSearchController(ComprarSearchPanel view, LaunchController parent) {
|
|
||||||
super(parent);
|
|
||||||
this.view = view;
|
|
||||||
this.repository = new CompraRepository();
|
|
||||||
this.validator = new CompraValidator(this.repository);
|
|
||||||
this.setupListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupListeners() {
|
|
||||||
this.view.getComprarButton().addActionListener(e -> this.getParentController().showCard(PanelName.COMPRAR_COMPRAR));
|
|
||||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
|
||||||
this.view.getSearchField().addActionListener(e -> this.search());
|
|
||||||
this.view.getVerButton().addActionListener(e -> this.view());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void search() {
|
|
||||||
String term = this.view.getSearchField().getText();
|
|
||||||
List<Compra> compras = this.repository.search(term);
|
|
||||||
this.loadComprarTable(compras);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void view() {
|
|
||||||
Compra compra = this.getSelectedCompra();
|
|
||||||
if (compra != null) {
|
|
||||||
// CompraViewController controller = (CompraViewController) this.getParentController().getCard(PanelName.COMPRAR_VIEW);
|
|
||||||
// controller.setCompra(compra);
|
|
||||||
// this.getParentController().showCard(PanelName.COMPRAR_VIEW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadComprarTable(List<Compra> compras) {
|
|
||||||
BaseTableModel<Compra> model = this.view.getModel();
|
|
||||||
model.setRows(compras);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Compra getSelectedCompra() {
|
|
||||||
int selectedRow = this.view.getTable().getSelectedRow();
|
|
||||||
if (selectedRow == -1) {
|
|
||||||
JOptionPane.showMessageDialog(
|
|
||||||
null,
|
|
||||||
"No hay copra seleccionada",
|
|
||||||
"Error",
|
|
||||||
JOptionPane.ERROR_MESSAGE
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.view.getModel().getRow(selectedRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
this.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reload() {
|
|
||||||
this.loadComprarTable();
|
|
||||||
this.view.getSearchField().requestFocus();
|
|
||||||
this.view.getTable().setRowSelectionInterval(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadComprarTable() {
|
|
||||||
List<Compra> compra = this.repository.getAll();
|
|
||||||
this.loadComprarTable(compra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BasePanel getView() {
|
|
||||||
return this.view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
package xyz.danielcortes.controllers.comprar;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import xyz.danielcortes.controllers.LaunchController;
|
|
||||||
import xyz.danielcortes.framework.BaseController;
|
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
|
||||||
import xyz.danielcortes.framework.PanelName;
|
|
||||||
import xyz.danielcortes.framework.ValidationResult;
|
|
||||||
import xyz.danielcortes.models.Ejemplar;
|
|
||||||
import xyz.danielcortes.models.Estado;
|
|
||||||
import xyz.danielcortes.models.Libro;
|
|
||||||
import xyz.danielcortes.repository.EjemplarRepository;
|
|
||||||
import xyz.danielcortes.repository.LibroRepository;
|
|
||||||
import xyz.danielcortes.validator.EjemplarValidator;
|
|
||||||
import xyz.danielcortes.views.comprar.ComprarSeleccionarPanel;
|
|
||||||
|
|
||||||
public class ComprarSeleccionarController extends BaseController {
|
|
||||||
|
|
||||||
private ComprarSeleccionarPanel view;
|
|
||||||
private LibroRepository libroRepository;
|
|
||||||
private EjemplarValidator ejemplarValidator;
|
|
||||||
|
|
||||||
private List<Ejemplar> ejemplares;
|
|
||||||
private List<Ejemplar> editing;
|
|
||||||
|
|
||||||
public ComprarSeleccionarController(ComprarSeleccionarPanel view, LaunchController parent) {
|
|
||||||
super(parent);
|
|
||||||
this.view = view;
|
|
||||||
this.libroRepository = new LibroRepository();
|
|
||||||
this.ejemplarValidator = new EjemplarValidator(new EjemplarRepository());
|
|
||||||
this.ejemplares = new ArrayList<>();
|
|
||||||
this.editing = new ArrayList<>();
|
|
||||||
this.setupListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupListeners() {
|
|
||||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
|
||||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
|
||||||
this.view.getRemoverButton().addActionListener(e -> this.remove());
|
|
||||||
this.view.getAgregarButton().addActionListener(e -> this.agregar());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void save() {
|
|
||||||
this.ejemplares.clear();
|
|
||||||
this.ejemplares.addAll(this.editing);
|
|
||||||
|
|
||||||
this.getParentController().showCard(PanelName.COMPRAR_COMPRAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void volver() {
|
|
||||||
this.editing.clear();
|
|
||||||
this.editing.addAll(this.ejemplares);
|
|
||||||
|
|
||||||
this.parentController.showCard(PanelName.COMPRAR_COMPRAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void remove() {
|
|
||||||
Ejemplar ejemplar = this.getSelectedEjemplar();
|
|
||||||
if (ejemplar == null)
|
|
||||||
return;
|
|
||||||
int index = this.view.getEjemplaresTable().getSelectedRow();
|
|
||||||
|
|
||||||
this.view.getEjemplaresTableModel().removeRow(index);
|
|
||||||
this.editing.remove(ejemplar);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void agregar() {
|
|
||||||
Libro libro = (Libro) this.view.getLibrosCombo().getSelectedItem();
|
|
||||||
if (libro == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
String serie = this.view.getSerieField().getText();
|
|
||||||
|
|
||||||
ValidationResult serieValidation = this.ejemplarValidator.validateSerie(serie, libro.getId(), this.editing);
|
|
||||||
if (serieValidation.hasError()) {
|
|
||||||
serieValidation.showErrorDialog();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ejemplar ejemplar = new Ejemplar();
|
|
||||||
ejemplar.setLibro(libro);
|
|
||||||
ejemplar.setSerie(serie);
|
|
||||||
ejemplar.setEstado(new Estado());
|
|
||||||
|
|
||||||
this.editing.add(ejemplar);
|
|
||||||
this.view.getEjemplaresTableModel().addRow(ejemplar);
|
|
||||||
|
|
||||||
this.view.getLibrosCombo().setSelectedIndex(0);
|
|
||||||
this.view.getSerieField().setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
private Ejemplar getSelectedEjemplar() {
|
|
||||||
int selectedRow = this.view.getEjemplaresTable().getSelectedRow();
|
|
||||||
if (selectedRow == -1) {
|
|
||||||
JOptionPane.showMessageDialog(
|
|
||||||
null,
|
|
||||||
"No hay ningun ejemplar seleccionado",
|
|
||||||
"Error",
|
|
||||||
JOptionPane.ERROR_MESSAGE
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.view.getEjemplaresTableModel().getRow(selectedRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
this.editing.clear();
|
|
||||||
this.editing.addAll(this.ejemplares);
|
|
||||||
|
|
||||||
this.fillLibros();
|
|
||||||
this.view.getLibrosCombo().setSelectedIndex(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillLibros() {
|
|
||||||
this.view.getLibrosComboModel().removeAllElements();
|
|
||||||
this.view.getLibrosComboModel().addAll(this.libroRepository.getAll());
|
|
||||||
|
|
||||||
this.view.getEjemplaresTableModel().setRows(this.ejemplares);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BasePanel getView() {
|
|
||||||
return this.view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Ejemplar> getEjemplares() {
|
|
||||||
return this.ejemplares;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package xyz.danielcortes.controllers.orden_compra;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import xyz.danielcortes.controllers.LaunchController;
|
||||||
|
import xyz.danielcortes.framework.BaseController;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
import xyz.danielcortes.framework.ChangeListener;
|
||||||
|
import xyz.danielcortes.framework.PanelName;
|
||||||
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraAceptarPanel;
|
||||||
|
|
||||||
|
public class OrdenCompraAceptarController extends BaseController {
|
||||||
|
|
||||||
|
private OrdenCompraAceptarPanel view;
|
||||||
|
private OrdenCompra ordenCompra;
|
||||||
|
|
||||||
|
public OrdenCompraAceptarController(OrdenCompraAceptarPanel view, LaunchController parent) {
|
||||||
|
super(parent);
|
||||||
|
this.view = view;
|
||||||
|
this.setupListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupListeners() {
|
||||||
|
this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH));
|
||||||
|
this.view.getPrecioNetoField().getDocument().addDocumentListener((ChangeListener) e -> this.calculatePrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculatePrice() {
|
||||||
|
try {
|
||||||
|
int neto = Integer.parseInt(this.view.getPrecioNetoField().getText());
|
||||||
|
|
||||||
|
float iva = (float) neto * .19f;
|
||||||
|
this.view.getIvaField().setText(String.valueOf(iva));
|
||||||
|
this.view.getTotalField().setText(String.valueOf(iva + neto));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
this.view.getIvaField().setText("0");
|
||||||
|
this.view.getTotalField().setText("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdenCompra(OrdenCompra ordenCompra) {
|
||||||
|
this.ordenCompra = ordenCompra;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
this.view.getAsignarButton().requestFocus();
|
||||||
|
this.view.getFechaEmisionPicker().setDate(LocalDate.now());
|
||||||
|
this.view.getIvaField().setText("0");
|
||||||
|
this.view.getPrecioNetoField().setText("0");
|
||||||
|
this.view.getTotalField().setText("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasePanel getView() {
|
||||||
|
return this.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package xyz.danielcortes.controllers.orden_compra;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import xyz.danielcortes.controllers.LaunchController;
|
||||||
|
import xyz.danielcortes.framework.BaseController;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
import xyz.danielcortes.framework.PanelName;
|
||||||
|
import xyz.danielcortes.framework.ValidationResult;
|
||||||
|
import xyz.danielcortes.models.Distribuidor;
|
||||||
|
import xyz.danielcortes.models.Libro;
|
||||||
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
import xyz.danielcortes.repository.DistribuidorRepository;
|
||||||
|
import xyz.danielcortes.repository.LibroRepository;
|
||||||
|
import xyz.danielcortes.repository.OrdenCompraRepository;
|
||||||
|
import xyz.danielcortes.validator.OrdenCompraValidator;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraCrearPanel;
|
||||||
|
|
||||||
|
public class OrdenCompraCrearController extends BaseController {
|
||||||
|
|
||||||
|
private OrdenCompraCrearPanel view;
|
||||||
|
private LibroRepository libroRepository;
|
||||||
|
private DistribuidorRepository distribuidorRepository;
|
||||||
|
private OrdenCompraRepository ordenCompraRepository;
|
||||||
|
private OrdenCompraValidator validator;
|
||||||
|
|
||||||
|
public OrdenCompraCrearController(OrdenCompraCrearPanel view, LaunchController parent) {
|
||||||
|
super(parent);
|
||||||
|
this.view = view;
|
||||||
|
this.libroRepository = new LibroRepository();
|
||||||
|
this.distribuidorRepository = new DistribuidorRepository();
|
||||||
|
this.ordenCompraRepository = new OrdenCompraRepository();
|
||||||
|
this.validator = new OrdenCompraValidator();
|
||||||
|
this.setupListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupListeners() {
|
||||||
|
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||||
|
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||||
|
this.view.getRemoverButton().addActionListener(e -> this.remove());
|
||||||
|
this.view.getAgregarButton().addActionListener(e -> this.agregar());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void save() {
|
||||||
|
List<Libro> libros = this.view.getLibroTableModel().getRows();
|
||||||
|
ValidationResult librosValidation = this.validator.validateLibros(libros);
|
||||||
|
if (librosValidation.hasError()) {
|
||||||
|
librosValidation.showErrorDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Distribuidor distribuidor = (Distribuidor) this.view.getDistribuidorCombo().getSelectedItem();
|
||||||
|
ValidationResult distribuidorValidation = this.validator.validateDistribuidor(distribuidor);
|
||||||
|
if (distribuidorValidation.hasError()) {
|
||||||
|
distribuidorValidation.showErrorDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrdenCompra ordenCompra = new OrdenCompra();
|
||||||
|
ordenCompra.setDistribuidor(distribuidor);
|
||||||
|
ordenCompra.setEstado("En Curso");
|
||||||
|
ordenCompra.setLibros(libros);
|
||||||
|
|
||||||
|
this.ordenCompraRepository.save(ordenCompra);
|
||||||
|
this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void volver() {
|
||||||
|
this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void remove() {
|
||||||
|
Libro libro = this.getSelectedLibro();
|
||||||
|
if (libro == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.view.getLibroTableModel().removeRow(libro);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void agregar() {
|
||||||
|
Libro libro = (Libro) this.view.getLibrosCombo().getSelectedItem();
|
||||||
|
if (libro == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int cantidad = (int) this.view.getCantidadSpinner().getValue();
|
||||||
|
for (int i = 0; i < cantidad; i++) {
|
||||||
|
this.view.getLibroTableModel().addRow(libro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Libro getSelectedLibro() {
|
||||||
|
int selectedRow = this.view.getLibrosTable().getSelectedRow();
|
||||||
|
if (selectedRow == -1) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"No hay ningun libro seleccionado",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.view.getLibroTableModel().getRow(selectedRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
this.fillLibros();
|
||||||
|
this.fillDistribuidor();
|
||||||
|
this.view.getLibrosCombo().setSelectedIndex(0);
|
||||||
|
this.view.getDistribuidorCombo().setSelectedIndex(0);
|
||||||
|
this.view.getLibroTableModel().removeRows();
|
||||||
|
this.view.getLibrosTable().clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillLibros() {
|
||||||
|
this.view.getLibrosComboModel().removeAllElements();
|
||||||
|
this.view.getLibrosComboModel().addAll(this.libroRepository.getAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillDistribuidor() {
|
||||||
|
this.view.getDistribuidorComboModel().removeAllElements();
|
||||||
|
this.view.getDistribuidorComboModel().addAll(this.distribuidorRepository.getAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasePanel getView() {
|
||||||
|
return this.view;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package xyz.danielcortes.controllers.orden_compra;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import xyz.danielcortes.controllers.LaunchController;
|
||||||
|
import xyz.danielcortes.framework.BaseController;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
import xyz.danielcortes.framework.BaseTableModel;
|
||||||
|
import xyz.danielcortes.framework.PanelName;
|
||||||
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
import xyz.danielcortes.repository.OrdenCompraRepository;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraSearchPanel;
|
||||||
|
|
||||||
|
public class OrdenCompraSearchController extends BaseController {
|
||||||
|
|
||||||
|
private OrdenCompraSearchPanel view;
|
||||||
|
private OrdenCompraRepository repository;
|
||||||
|
|
||||||
|
public OrdenCompraSearchController(OrdenCompraSearchPanel view, LaunchController parent) {
|
||||||
|
super(parent);
|
||||||
|
this.view = view;
|
||||||
|
this.repository = new OrdenCompraRepository();
|
||||||
|
this.setupListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupListeners() {
|
||||||
|
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||||
|
this.view.getSearchField().addActionListener(e -> this.search());
|
||||||
|
|
||||||
|
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.ORDEN_COMPRA_CREAR));
|
||||||
|
this.view.getVerButton().addActionListener(e -> this.view());
|
||||||
|
this.view.getCancelarButton().addActionListener(e -> this.cancelar());
|
||||||
|
this.view.getAceptarButton().addActionListener(e -> this.aceptar());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void search() {
|
||||||
|
String term = this.view.getSearchField().getText();
|
||||||
|
List<OrdenCompra> ordenCompras = this.repository.search(term);
|
||||||
|
this.loadComprarTable(ordenCompras);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void view() {
|
||||||
|
OrdenCompra ordenCompra = this.getSelectedOrdenCompra();
|
||||||
|
if (ordenCompra != null) {
|
||||||
|
OrdenCompraViewController controller = (OrdenCompraViewController) this.getParentController().getCard(PanelName.ORDEN_COMPRA_VIEW);
|
||||||
|
controller.setOrdenCompra(ordenCompra);
|
||||||
|
this.getParentController().showCard(PanelName.ORDEN_COMPRA_VIEW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelar() {
|
||||||
|
OrdenCompra ordenCompra = this.getSelectedOrdenCompra();
|
||||||
|
if (ordenCompra == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ordenCompra.getEstado().equals("Cancelada")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden ya esta cancelada",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else if (ordenCompra.getEstado().equals("Aceptada")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden ya fue aceptada",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else if (!ordenCompra.getEstado().equals("En Curso")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden esta en un estado imposible, corre!",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = JOptionPane.showConfirmDialog(
|
||||||
|
null,
|
||||||
|
"Esta seguro de cancelar esta orden de compra?",
|
||||||
|
"Confirmar",
|
||||||
|
JOptionPane.YES_NO_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == JOptionPane.YES_OPTION) {
|
||||||
|
ordenCompra.setEstado("Cancelada");
|
||||||
|
this.repository.update(ordenCompra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void aceptar() {
|
||||||
|
OrdenCompra ordenCompra = this.getSelectedOrdenCompra();
|
||||||
|
if (ordenCompra == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ordenCompra.getEstado().equals("Cancelada")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden fue cancelada, no se pude aceptar",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else if (ordenCompra.getEstado().equals("Aceptada")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden ya fue aceptada",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else if (!ordenCompra.getEstado().equals("En Curso")) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"La orden está en un estado imposible, corre!",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OrdenCompraAceptarController controller = (OrdenCompraAceptarController) this.getParentController().getCard(PanelName.ORDEN_COMPRA_ACEPTAR);
|
||||||
|
controller.setOrdenCompra(ordenCompra);
|
||||||
|
this.getParentController().showCard(PanelName.ORDEN_COMPRA_ACEPTAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadComprarTable(List<OrdenCompra> ordenCompra) {
|
||||||
|
BaseTableModel<OrdenCompra> model = this.view.getModel();
|
||||||
|
model.setRows(ordenCompra);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OrdenCompra getSelectedOrdenCompra() {
|
||||||
|
int selectedRow = this.view.getTable().getSelectedRow();
|
||||||
|
if (selectedRow == -1) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"No hay orden de compra seleccionada",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.view.getModel().getRow(selectedRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload() {
|
||||||
|
this.loadComprarTable();
|
||||||
|
this.view.getSearchField().requestFocus();
|
||||||
|
this.view.getTable().setRowSelectionInterval(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadComprarTable() {
|
||||||
|
List<OrdenCompra> ordenCompra = this.repository.getAll();
|
||||||
|
this.loadComprarTable(ordenCompra);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasePanel getView() {
|
||||||
|
return this.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package xyz.danielcortes.controllers.orden_compra;
|
||||||
|
|
||||||
|
import xyz.danielcortes.controllers.LaunchController;
|
||||||
|
import xyz.danielcortes.framework.BaseController;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
import xyz.danielcortes.framework.PanelName;
|
||||||
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
import xyz.danielcortes.views.orden_compra.OrdenCompraViewPanel;
|
||||||
|
|
||||||
|
public class OrdenCompraViewController extends BaseController {
|
||||||
|
|
||||||
|
private OrdenCompraViewPanel view;
|
||||||
|
private OrdenCompra ordenCompra;
|
||||||
|
|
||||||
|
public OrdenCompraViewController(OrdenCompraViewPanel view, LaunchController parent) {
|
||||||
|
super(parent);
|
||||||
|
this.view = view;
|
||||||
|
this.setupListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupListeners() {
|
||||||
|
this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdenCompra(OrdenCompra ordenCompra) {
|
||||||
|
this.ordenCompra = ordenCompra;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
this.view.getDistribuidorField().setText(this.ordenCompra.getDistribuidor().getRut());
|
||||||
|
this.fillTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasePanel getView() {
|
||||||
|
return this.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillTable() {
|
||||||
|
if (this.ordenCompra != null) {
|
||||||
|
this.view.getLibroTableModel().setRows(this.ordenCompra.getLibros());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
|||||||
* @param valueAt TriFunction la cual recibe por parametros: - La lista de filas de la tabla - Un Integer indicando la fila del que se necesita el
|
* @param valueAt TriFunction la cual recibe por parametros: - La lista de filas de la tabla - Un Integer indicando la fila del que se necesita el
|
||||||
* valor - Un Integer indicando la columna de la que se necesita el valor Y esta debe retornar un objeto con toString para poder ser mostrado en la
|
* valor - Un Integer indicando la columna de la que se necesita el valor Y esta debe retornar un objeto con toString para poder ser mostrado en la
|
||||||
* tabla
|
* tabla
|
||||||
*
|
* <p>
|
||||||
* Se sugiere el siguiente tipo de implementacion para la funcion (row, rowIndex, colIndex) -> { switch (colIndex) { case 0: return
|
* Se sugiere el siguiente tipo de implementacion para la funcion (row, rowIndex, colIndex) -> { switch (colIndex) { case 0: return
|
||||||
* row.get(rowIndex).getColumn1(); case 1: return row.get(rowIndex).getColumn2(); case 2: return row.get(rowIndex).getColumn3(); case 3: return
|
* row.get(rowIndex).getColumn1(); case 1: return row.get(rowIndex).getColumn2(); case 2: return row.get(rowIndex).getColumn3(); case 3: return
|
||||||
* row.get(rowIndex).getColumn4(); } return null; }
|
* row.get(rowIndex).getColumn4(); } return null; }
|
||||||
@@ -61,6 +61,30 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
|||||||
return this.valueAt.apply(this.rows, rowIndex, columnIndex);
|
return this.valueAt.apply(this.rows, rowIndex, columnIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeRow(int row) {
|
||||||
|
this.rows.remove(row);
|
||||||
|
this.fireTableRowsDeleted(row, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeRow(T t) {
|
||||||
|
int removed = this.rows.indexOf(t);
|
||||||
|
this.rows.remove(removed);
|
||||||
|
this.fireTableRowsDeleted(removed, removed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getRow(int row) {
|
||||||
|
if (row > -1 || row < this.getRowCount()) {
|
||||||
|
return this.rows.get(row);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getRows() {
|
||||||
|
return this.rows;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRows(List<T> items) {
|
public void setRows(List<T> items) {
|
||||||
this.removeRows();
|
this.removeRows();
|
||||||
this.rows.addAll(items);
|
this.rows.addAll(items);
|
||||||
@@ -74,17 +98,4 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
|||||||
this.fireTableRowsDeleted(0, rowCount - 1);
|
this.fireTableRowsDeleted(0, rowCount - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeRow(int row) {
|
|
||||||
this.rows.remove(row);
|
|
||||||
this.fireTableRowsDeleted(row, row);
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getRow(int row) {
|
|
||||||
if (row > -1 || row < this.getRowCount()) {
|
|
||||||
return this.rows.get(row);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/main/java/xyz/danielcortes/framework/ChangeListener.java
Normal file
24
src/main/java/xyz/danielcortes/framework/ChangeListener.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package xyz.danielcortes.framework;
|
||||||
|
|
||||||
|
import javax.swing.event.DocumentEvent;
|
||||||
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
|
public interface ChangeListener extends DocumentListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void insertUpdate(DocumentEvent e) {
|
||||||
|
this.changed(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void removeUpdate(DocumentEvent e) {
|
||||||
|
this.changed(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void changedUpdate(DocumentEvent e) {
|
||||||
|
this.changed(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void changed(DocumentEvent e);
|
||||||
|
}
|
||||||
@@ -97,10 +97,10 @@ public enum PanelName {
|
|||||||
CLIENTE_DIRECCION_CREATE,
|
CLIENTE_DIRECCION_CREATE,
|
||||||
CLIENTE_DIRECCION_UPDATE,
|
CLIENTE_DIRECCION_UPDATE,
|
||||||
|
|
||||||
COMPRAR_SEARCH,
|
ORDEN_COMPRA_SEARCH,
|
||||||
COMPRAR_SELECCIONAR,
|
ORDEN_COMPRA_ACEPTAR,
|
||||||
COMPRAR_VIEW,
|
ORDEN_COMPRA_VIEW,
|
||||||
COMPRAR_COMPRAR,
|
ORDEN_COMPRA_CREAR,
|
||||||
|
|
||||||
VENDER_SEARCH,
|
VENDER_SEARCH,
|
||||||
VENDER_VENDER,
|
VENDER_VENDER,
|
||||||
|
|||||||
@@ -66,6 +66,14 @@ public class Libro {
|
|||||||
)
|
)
|
||||||
private List<Categoria> categorias;
|
private List<Categoria> categorias;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(
|
||||||
|
name = "libro_orden_compra",
|
||||||
|
joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "orden_compra_id", referencedColumnName = "id")
|
||||||
|
)
|
||||||
|
private List<OrdenCompra> ordenCompras;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "editorial_id")
|
@JoinColumn(name = "editorial_id")
|
||||||
private Editorial editorial;
|
private Editorial editorial;
|
||||||
@@ -170,6 +178,15 @@ public class Libro {
|
|||||||
this.ejemplares = ejemplar;
|
this.ejemplares = ejemplar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<OrdenCompra> getOrdenCompras() {
|
||||||
|
if (this.ordenCompras == null)
|
||||||
|
this.ordenCompras = new ArrayList<>();
|
||||||
|
return this.ordenCompras;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdenCompras(List<OrdenCompra> ordenCompras) {
|
||||||
|
this.ordenCompras = ordenCompras;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
96
src/main/java/xyz/danielcortes/models/OrdenCompra.java
Normal file
96
src/main/java/xyz/danielcortes/models/OrdenCompra.java
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
package xyz.danielcortes.models;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "orden_compra")
|
||||||
|
public class OrdenCompra {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(name = "estado")
|
||||||
|
private String estado;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(
|
||||||
|
name = "libro_orden_compra",
|
||||||
|
joinColumns = @JoinColumn(name = "orden_compra_id", referencedColumnName = "id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"))
|
||||||
|
private List<Libro> libros;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "distribuidor_id")
|
||||||
|
private Distribuidor distribuidor;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "compra_id")
|
||||||
|
private Compra compra;
|
||||||
|
|
||||||
|
@Column(name = "inserted_at")
|
||||||
|
private LocalDateTime insertedAt;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return this.estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Libro> getLibros() {
|
||||||
|
if (this.libros == null)
|
||||||
|
this.libros = new ArrayList<>();
|
||||||
|
return this.libros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLibros(List<Libro> libros) {
|
||||||
|
this.libros = libros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Distribuidor getDistribuidor() {
|
||||||
|
return this.distribuidor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistribuidor(Distribuidor distribuidor) {
|
||||||
|
this.distribuidor = distribuidor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Compra getCompra() {
|
||||||
|
return this.compra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompra(Compra compra) {
|
||||||
|
this.compra = compra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getInsertedAt() {
|
||||||
|
return this.insertedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||||
|
this.insertedAt = insertedAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package xyz.danielcortes.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
import xyz.danielcortes.framework.BaseRepository;
|
||||||
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
|
||||||
|
public class OrdenCompraRepository extends BaseRepository<OrdenCompra> {
|
||||||
|
|
||||||
|
public OrdenCompraRepository() {
|
||||||
|
super(OrdenCompra.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OrdenCompra> search(String term) {
|
||||||
|
Query query = this.em.createQuery("SELECT o FROM OrdenCompra o WHERE LOWER(o.estado) LIKE :term");
|
||||||
|
query.setParameter("term", "%" + term.toLowerCase() + "%");
|
||||||
|
return query.getResultList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package xyz.danielcortes.validator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import xyz.danielcortes.framework.ValidationResult;
|
||||||
|
import xyz.danielcortes.models.Compra;
|
||||||
|
import xyz.danielcortes.models.Distribuidor;
|
||||||
|
import xyz.danielcortes.models.Libro;
|
||||||
|
|
||||||
|
public class OrdenCompraValidator {
|
||||||
|
|
||||||
|
public ValidationResult validateEstado(String estado) {
|
||||||
|
if (estado == null) {
|
||||||
|
return new ValidationResult("No hay estado");
|
||||||
|
}
|
||||||
|
if (estado.isBlank()) {
|
||||||
|
return new ValidationResult("El estado esta vacio");
|
||||||
|
}
|
||||||
|
//Lo siento, me vi en la necesidad de hacer la validacion asi
|
||||||
|
// se ve mas cul
|
||||||
|
switch (estado) {
|
||||||
|
case "En Curso":
|
||||||
|
case "Aceptada":
|
||||||
|
case "Cancelada":
|
||||||
|
return ValidationResult.NON_ERROR;
|
||||||
|
default:
|
||||||
|
return new ValidationResult("El estado no es valido");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationResult validateLibros(List<Libro> libros) {
|
||||||
|
if (libros == null || libros.isEmpty()) {
|
||||||
|
return new ValidationResult("No hay libros");
|
||||||
|
}
|
||||||
|
return ValidationResult.NON_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationResult validateDistribuidor(Distribuidor distribuidor) {
|
||||||
|
if (distribuidor == null) {
|
||||||
|
return new ValidationResult("No hay distribuidor");
|
||||||
|
}
|
||||||
|
return ValidationResult.NON_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationResult validateCompra(Compra compra) {
|
||||||
|
if (compra == null) {
|
||||||
|
return new ValidationResult("No hay compra");
|
||||||
|
}
|
||||||
|
return ValidationResult.NON_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.comprar.ComprarComprarPanel">
|
|
||||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="20" left="20" bottom="20" right="20"/>
|
|
||||||
<constraints>
|
|
||||||
<xy x="20" y="20" width="518" height="530"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="de524" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Libros:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<vspacer id="36014">
|
|
||||||
<constraints>
|
|
||||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<hspacer id="11118">
|
|
||||||
<constraints>
|
|
||||||
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
<hspacer id="43954">
|
|
||||||
<constraints>
|
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
<component id="847b5" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Distribuidor:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="66798" class="javax.swing.JComboBox" binding="distribuidorCombo" custom-create="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="2b462" class="javax.swing.JButton" binding="seleccionarButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Seleccionar"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<grid id="15262" layout-manager="GridLayoutManager" row-count="10" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="10" left="10" bottom="10" right="10"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="line" title="Factura"/>
|
|
||||||
<children>
|
|
||||||
<component id="3164e" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Folio:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="3a289" class="javax.swing.JTextField" binding="folioField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="66882" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Precio Neto:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="38890" class="javax.swing.JTextField" binding="precioNetoField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="94d68" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Precio IVA:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="2b4c9" class="javax.swing.JTextField" binding="precioIVAField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<editable value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="56f53" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Precio Bruto:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="bf663" class="javax.swing.JTextField" binding="precioBrutoField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<editable value="false"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="552e6" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Fecha compra:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="51579" class="com.github.lgooddatepicker.components.DatePicker" binding="fechaCompraField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="400" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="17d46" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="74b0c" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Guardar"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="45282" class="javax.swing.JButton" binding="volverButton" default-binding="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Volver"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</form>
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
package xyz.danielcortes.views.comprar;
|
|
||||||
|
|
||||||
import com.github.lgooddatepicker.components.DatePicker;
|
|
||||||
import com.intellij.uiDesigner.core.GridConstraints;
|
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
|
||||||
import com.intellij.uiDesigner.core.Spacer;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Insets;
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
|
||||||
import xyz.danielcortes.models.Distribuidor;
|
|
||||||
|
|
||||||
public class ComprarComprarPanel extends BasePanel {
|
|
||||||
|
|
||||||
private JPanel contentPane;
|
|
||||||
private JComboBox<Distribuidor> distribuidorCombo;
|
|
||||||
private DefaultComboBoxModel<Distribuidor> distribuidorModel;
|
|
||||||
private JButton seleccionarButton;
|
|
||||||
private JTextField folioField;
|
|
||||||
private JTextField precioNetoField;
|
|
||||||
private JTextField precioIVAField;
|
|
||||||
private JTextField precioBrutoField;
|
|
||||||
private DatePicker fechaCompraField;
|
|
||||||
private JButton guardarButton;
|
|
||||||
private JButton volverButton;
|
|
||||||
|
|
||||||
{
|
|
||||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
|
||||||
// >>> IMPORTANT!! <<<
|
|
||||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
|
||||||
this.$$$setupUI$$$();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getContentPane() {
|
|
||||||
return this.contentPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JComboBox getDistribuidorCombo() {
|
|
||||||
return this.distribuidorCombo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getSeleccionarButton() {
|
|
||||||
return this.seleccionarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getFolioField() {
|
|
||||||
return this.folioField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getPrecioNetoField() {
|
|
||||||
return this.precioNetoField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getPrecioIVAField() {
|
|
||||||
return this.precioIVAField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTextField getPrecioBrutoField() {
|
|
||||||
return this.precioBrutoField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatePicker getFechaCompraField() {
|
|
||||||
return this.fechaCompraField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getGuardarButton() {
|
|
||||||
return this.guardarButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JButton getVolverButton() {
|
|
||||||
return this.volverButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultComboBoxModel<Distribuidor> getDistribuidorModel() {
|
|
||||||
return this.distribuidorModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
|
||||||
*
|
|
||||||
* @noinspection ALL
|
|
||||||
*/
|
|
||||||
private void $$$setupUI$$$() {
|
|
||||||
createUIComponents();
|
|
||||||
contentPane = new JPanel();
|
|
||||||
contentPane.setLayout(new GridLayoutManager(7, 3, new Insets(20, 20, 20, 20), -1, -1));
|
|
||||||
final JLabel label1 = new JLabel();
|
|
||||||
label1.setText("Libros:");
|
|
||||||
contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final Spacer spacer1 = new Spacer();
|
|
||||||
contentPane.add(spacer1,
|
|
||||||
new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
|
||||||
null, null, 0, false));
|
|
||||||
final Spacer spacer2 = new Spacer();
|
|
||||||
contentPane.add(spacer2,
|
|
||||||
new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
|
||||||
null, null, 0, false));
|
|
||||||
final Spacer spacer3 = new Spacer();
|
|
||||||
contentPane.add(spacer3,
|
|
||||||
new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
|
||||||
null, null, 0, false));
|
|
||||||
final JLabel label2 = new JLabel();
|
|
||||||
label2.setText("Distribuidor:");
|
|
||||||
contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
contentPane.add(distribuidorCombo,
|
|
||||||
new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
seleccionarButton = new JButton();
|
|
||||||
seleccionarButton.setText("Seleccionar");
|
|
||||||
contentPane.add(seleccionarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JPanel panel1 = new JPanel();
|
|
||||||
panel1.setLayout(new GridLayoutManager(10, 1, new Insets(10, 10, 10, 10), -1, -1));
|
|
||||||
contentPane.add(panel1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), "Factura"));
|
|
||||||
final JLabel label3 = new JLabel();
|
|
||||||
label3.setText("Folio:");
|
|
||||||
panel1.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
folioField = new JTextField();
|
|
||||||
folioField.setText("");
|
|
||||||
panel1.add(folioField,
|
|
||||||
new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
final JLabel label4 = new JLabel();
|
|
||||||
label4.setText("Precio Neto:");
|
|
||||||
panel1.add(label4, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
precioNetoField = new JTextField();
|
|
||||||
panel1.add(precioNetoField,
|
|
||||||
new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
final JLabel label5 = new JLabel();
|
|
||||||
label5.setText("Precio IVA:");
|
|
||||||
panel1.add(label5, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
precioIVAField = new JTextField();
|
|
||||||
precioIVAField.setEditable(false);
|
|
||||||
panel1.add(precioIVAField,
|
|
||||||
new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
final JLabel label6 = new JLabel();
|
|
||||||
label6.setText("Precio Bruto:");
|
|
||||||
panel1.add(label6, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
precioBrutoField = new JTextField();
|
|
||||||
precioBrutoField.setEditable(false);
|
|
||||||
panel1.add(precioBrutoField,
|
|
||||||
new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
final JLabel label7 = new JLabel();
|
|
||||||
label7.setText("Fecha compra:");
|
|
||||||
panel1.add(label7, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
fechaCompraField = new DatePicker();
|
|
||||||
panel1.add(fechaCompraField,
|
|
||||||
new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
|
||||||
final JPanel panel2 = new JPanel();
|
|
||||||
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
|
||||||
contentPane.add(panel2, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
|
||||||
guardarButton = new JButton();
|
|
||||||
guardarButton.setText("Guardar");
|
|
||||||
panel2.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
|
||||||
null, 0, false));
|
|
||||||
volverButton = new JButton();
|
|
||||||
volverButton.setText("Volver");
|
|
||||||
panel2.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
|
||||||
null, 0, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createUIComponents() {
|
|
||||||
this.distribuidorModel = new DefaultComboBoxModel<>();
|
|
||||||
this.distribuidorCombo = new JComboBox<>(this.distribuidorModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @noinspection ALL
|
|
||||||
*/
|
|
||||||
public JComponent $$$getRootComponent$$$() {
|
|
||||||
return contentPane;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.orden_compra.OrdenCompraAceptarPanel">
|
||||||
|
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="14" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="20" left="20" bottom="20" right="20"/>
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="486" height="491"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="a8906" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Folio:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<vspacer id="b5aea">
|
||||||
|
<constraints>
|
||||||
|
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</vspacer>
|
||||||
|
<component id="bd65f" class="javax.swing.JTextField" binding="folioField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="400" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<hspacer id="9e3ea">
|
||||||
|
<constraints>
|
||||||
|
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<hspacer id="611be">
|
||||||
|
<constraints>
|
||||||
|
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<component id="3bdd0" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Precio Neto:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="352ec" class="javax.swing.JTextField" binding="precioNetoField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="78cc8" class="javax.swing.JTextField" binding="ivaField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<editable value="false"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="d16b6" class="javax.swing.JTextField" binding="totalField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<editable value="false"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="57cd3" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="IVA:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="bb127" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Total:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="db02f" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Fecha Emision:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="24785" class="com.github.lgooddatepicker.components.DatePicker" binding="fechaEmisionPicker">
|
||||||
|
<constraints>
|
||||||
|
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<grid id="f1fd0" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="d3f2e" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Guardar"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="79e5d" class="javax.swing.JButton" binding="volverButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Volver"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<component id="6286" class="javax.swing.JButton" binding="asignarButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Asignar"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="c2699" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Ejemplares:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package xyz.danielcortes.views.orden_compra;
|
||||||
|
|
||||||
|
import com.github.lgooddatepicker.components.DatePicker;
|
||||||
|
import com.intellij.uiDesigner.core.GridConstraints;
|
||||||
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
|
import com.intellij.uiDesigner.core.Spacer;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
|
||||||
|
public class OrdenCompraAceptarPanel extends BasePanel {
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
private JTextField folioField;
|
||||||
|
private JTextField precioNetoField;
|
||||||
|
private JTextField ivaField;
|
||||||
|
private JTextField totalField;
|
||||||
|
private DatePicker fechaEmisionPicker;
|
||||||
|
private JButton asignarButton;
|
||||||
|
private JButton guardarButton;
|
||||||
|
private JButton volverButton;
|
||||||
|
|
||||||
|
{
|
||||||
|
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||||
|
// >>> IMPORTANT!! <<<
|
||||||
|
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||||
|
this.$$$setupUI$$$();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JPanel getContentPane() {
|
||||||
|
return this.contentPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTextField getFolioField() {
|
||||||
|
return this.folioField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTextField getPrecioNetoField() {
|
||||||
|
return this.precioNetoField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTextField getIvaField() {
|
||||||
|
return this.ivaField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTextField getTotalField() {
|
||||||
|
return this.totalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatePicker getFechaEmisionPicker() {
|
||||||
|
return this.fechaEmisionPicker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JButton getAsignarButton() {
|
||||||
|
return this.asignarButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JButton getGuardarButton() {
|
||||||
|
return this.guardarButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JButton getVolverButton() {
|
||||||
|
return this.volverButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
||||||
|
*
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
private void $$$setupUI$$$() {
|
||||||
|
contentPane = new JPanel();
|
||||||
|
contentPane.setLayout(new GridLayoutManager(14, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||||
|
final JLabel label1 = new JLabel();
|
||||||
|
label1.setText("Folio:");
|
||||||
|
contentPane.add(label1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final Spacer spacer1 = new Spacer();
|
||||||
|
contentPane.add(spacer1,
|
||||||
|
new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||||
|
null, null, 0, false));
|
||||||
|
folioField = new JTextField();
|
||||||
|
contentPane.add(folioField,
|
||||||
|
new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
|
||||||
|
final Spacer spacer2 = new Spacer();
|
||||||
|
contentPane.add(spacer2,
|
||||||
|
new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||||
|
null, null, null, 0, false));
|
||||||
|
final Spacer spacer3 = new Spacer();
|
||||||
|
contentPane.add(spacer3,
|
||||||
|
new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
|
||||||
|
null, null, null, 0, false));
|
||||||
|
final JLabel label2 = new JLabel();
|
||||||
|
label2.setText("Precio Neto:");
|
||||||
|
contentPane.add(label2, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
precioNetoField = new JTextField();
|
||||||
|
contentPane.add(precioNetoField,
|
||||||
|
new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||||
|
ivaField = new JTextField();
|
||||||
|
ivaField.setEditable(false);
|
||||||
|
contentPane.add(ivaField,
|
||||||
|
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||||
|
totalField = new JTextField();
|
||||||
|
totalField.setEditable(false);
|
||||||
|
contentPane.add(totalField,
|
||||||
|
new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||||
|
final JLabel label3 = new JLabel();
|
||||||
|
label3.setText("IVA:");
|
||||||
|
contentPane.add(label3, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final JLabel label4 = new JLabel();
|
||||||
|
label4.setText("Total:");
|
||||||
|
contentPane.add(label4, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final JLabel label5 = new JLabel();
|
||||||
|
label5.setText("Fecha Emision:");
|
||||||
|
contentPane.add(label5, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
fechaEmisionPicker = new DatePicker();
|
||||||
|
contentPane.add(fechaEmisionPicker,
|
||||||
|
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final JPanel panel1 = new JPanel();
|
||||||
|
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
contentPane.add(panel1, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
|
guardarButton = new JButton();
|
||||||
|
guardarButton.setText("Guardar");
|
||||||
|
panel1.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
volverButton = new JButton();
|
||||||
|
volverButton.setText("Volver");
|
||||||
|
panel1.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
asignarButton = new JButton();
|
||||||
|
asignarButton.setText("Asignar");
|
||||||
|
contentPane.add(asignarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
final JLabel label6 = new JLabel();
|
||||||
|
label6.setText("Ejemplares:");
|
||||||
|
contentPane.add(label6, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
public JComponent $$$getRootComponent$$$() {
|
||||||
|
return contentPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,28 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.comprar.ComprarSeleccionarPanel">
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.orden_compra.OrdenCompraCrearPanel">
|
||||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="8" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="20" left="20" bottom="20" right="20"/>
|
<margin top="20" left="20" bottom="20" right="20"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="20" y="20" width="631" height="400"/>
|
<xy x="20" y="20" width="441" height="455"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<vspacer id="13b47">
|
<vspacer id="13b47">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
<grid row="7" column="1" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</vspacer>
|
</vspacer>
|
||||||
<scrollpane id="3750c">
|
<scrollpane id="3750c">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="400" height="-1"/>
|
<preferred-size width="400" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="2e370" class="javax.swing.JTable" binding="ejemplaresTable" custom-create="true" default-binding="true">
|
<component id="2e370" class="javax.swing.JTable" binding="librosTable" custom-create="true">
|
||||||
<constraints/>
|
<constraints/>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
@@ -30,59 +30,25 @@
|
|||||||
</scrollpane>
|
</scrollpane>
|
||||||
<hspacer id="32a85">
|
<hspacer id="32a85">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="7" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</hspacer>
|
</hspacer>
|
||||||
<hspacer id="bd6b7">
|
<hspacer id="bd6b7">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</hspacer>
|
</hspacer>
|
||||||
<grid id="5d741" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="5d741" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="db345" class="javax.swing.JComboBox" binding="librosCombo" custom-create="true">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="350" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
</component>
|
|
||||||
<component id="6693" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Libro:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="5aecc" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Serie:"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="7cdc5" class="javax.swing.JTextField" binding="serieField">
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="150" height="-1"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="5c6b2" class="javax.swing.JButton" binding="agregarButton" default-binding="true">
|
<component id="5c6b2" class="javax.swing.JButton" binding="agregarButton" default-binding="true">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -90,19 +56,9 @@
|
|||||||
<text value="Agregar"/>
|
<text value="Agregar"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
<grid id="ca98b" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<component id="ef939" class="javax.swing.JButton" binding="removerButton">
|
<component id="ef939" class="javax.swing.JButton" binding="removerButton">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -110,6 +66,16 @@
|
|||||||
<text value="Remover"/>
|
<text value="Remover"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="ca98b" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="6" column="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
<component id="f66dd" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
<component id="f66dd" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
@@ -132,6 +98,50 @@
|
|||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
|
<component id="76afc" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Distribuidor:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="f7fc5" class="javax.swing.JComboBox" binding="distribuidorCombo" custom-create="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="44e2c" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Cantidad:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="6693" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Libro:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="db345" class="javax.swing.JComboBox" binding="librosCombo" custom-create="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="51242" class="javax.swing.JSpinner" binding="cantidadSpinner" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="50" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</form>
|
</form>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package xyz.danielcortes.views.comprar;
|
package xyz.danielcortes.views.orden_compra;
|
||||||
|
|
||||||
import com.intellij.uiDesigner.core.GridConstraints;
|
import com.intellij.uiDesigner.core.GridConstraints;
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
@@ -12,25 +12,27 @@ import javax.swing.JComponent;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSpinner;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.JTextField;
|
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
import xyz.danielcortes.framework.BaseTableModel;
|
import xyz.danielcortes.framework.BaseTableModel;
|
||||||
import xyz.danielcortes.models.Ejemplar;
|
import xyz.danielcortes.models.Distribuidor;
|
||||||
import xyz.danielcortes.models.Libro;
|
import xyz.danielcortes.models.Libro;
|
||||||
|
|
||||||
public class ComprarSeleccionarPanel extends BasePanel {
|
public class OrdenCompraCrearPanel extends BasePanel {
|
||||||
|
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private JTable ejemplaresTable;
|
private JTable librosTable;
|
||||||
private BaseTableModel<Ejemplar> ejemplaresTableModel;
|
private BaseTableModel<Libro> libroTableModel;
|
||||||
private JComboBox<Libro> librosCombo;
|
private JComboBox<Libro> librosCombo;
|
||||||
private DefaultComboBoxModel<Libro> librosComboModel;
|
private DefaultComboBoxModel<Libro> librosComboModel;
|
||||||
|
private JComboBox<Distribuidor> distribuidorCombo;
|
||||||
|
private DefaultComboBoxModel<Distribuidor> distribuidorComboModel;
|
||||||
private JButton agregarButton;
|
private JButton agregarButton;
|
||||||
private JButton removerButton;
|
private JButton removerButton;
|
||||||
private JButton guardarButton;
|
private JButton guardarButton;
|
||||||
private JButton volverButton;
|
private JButton volverButton;
|
||||||
private JTextField serieField;
|
private JSpinner cantidadSpinner;
|
||||||
|
|
||||||
{
|
{
|
||||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||||
@@ -44,14 +46,22 @@ public class ComprarSeleccionarPanel extends BasePanel {
|
|||||||
return this.contentPane;
|
return this.contentPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTable getEjemplaresTable() {
|
public JTable getLibrosTable() {
|
||||||
return this.ejemplaresTable;
|
return this.librosTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JComboBox getLibrosCombo() {
|
public BaseTableModel<Libro> getLibroTableModel() {
|
||||||
|
return this.libroTableModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JComboBox<Libro> getLibrosCombo() {
|
||||||
return this.librosCombo;
|
return this.librosCombo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DefaultComboBoxModel<Libro> getLibrosComboModel() {
|
||||||
|
return this.librosComboModel;
|
||||||
|
}
|
||||||
|
|
||||||
public JButton getAgregarButton() {
|
public JButton getAgregarButton() {
|
||||||
return this.agregarButton;
|
return this.agregarButton;
|
||||||
}
|
}
|
||||||
@@ -68,16 +78,16 @@ public class ComprarSeleccionarPanel extends BasePanel {
|
|||||||
return this.volverButton;
|
return this.volverButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseTableModel<Ejemplar> getEjemplaresTableModel() {
|
public JComboBox getDistribuidorCombo() {
|
||||||
return this.ejemplaresTableModel;
|
return this.distribuidorCombo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JTextField getSerieField() {
|
public DefaultComboBoxModel<Distribuidor> getDistribuidorComboModel() {
|
||||||
return this.serieField;
|
return this.distribuidorComboModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultComboBoxModel<Libro> getLibrosComboModel() {
|
public JSpinner getCantidadSpinner() {
|
||||||
return this.librosComboModel;
|
return this.cantidadSpinner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,60 +98,44 @@ public class ComprarSeleccionarPanel extends BasePanel {
|
|||||||
private void $$$setupUI$$$() {
|
private void $$$setupUI$$$() {
|
||||||
createUIComponents();
|
createUIComponents();
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
contentPane.setLayout(new GridLayoutManager(5, 3, new Insets(20, 20, 20, 20), -1, -1));
|
contentPane.setLayout(new GridLayoutManager(8, 4, new Insets(20, 20, 20, 20), -1, -1));
|
||||||
final Spacer spacer1 = new Spacer();
|
final Spacer spacer1 = new Spacer();
|
||||||
contentPane.add(spacer1,
|
contentPane.add(spacer1,
|
||||||
new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
new GridConstraints(7, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||||
null, null, 0, false));
|
null, null, 0, false));
|
||||||
final JScrollPane scrollPane1 = new JScrollPane();
|
final JScrollPane scrollPane1 = new JScrollPane();
|
||||||
contentPane.add(scrollPane1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
contentPane.add(scrollPane1, new GridConstraints(5, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false));
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false));
|
||||||
scrollPane1.setViewportView(ejemplaresTable);
|
scrollPane1.setViewportView(librosTable);
|
||||||
final Spacer spacer2 = new Spacer();
|
final Spacer spacer2 = new Spacer();
|
||||||
contentPane.add(spacer2,
|
contentPane.add(spacer2,
|
||||||
new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
new GridConstraints(7, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||||
null, null, 0, false));
|
null, null, 0, false));
|
||||||
final Spacer spacer3 = new Spacer();
|
final Spacer spacer3 = new Spacer();
|
||||||
contentPane.add(spacer3,
|
contentPane.add(spacer3,
|
||||||
new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||||
null, null, 0, false));
|
null, null, 0, false));
|
||||||
final JPanel panel1 = new JPanel();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
contentPane.add(panel1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
contentPane.add(panel1, new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
panel1.add(librosCombo,
|
|
||||||
new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(350, -1), null, 0, false));
|
|
||||||
final JLabel label1 = new JLabel();
|
|
||||||
label1.setText("Libro:");
|
|
||||||
panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
final JLabel label2 = new JLabel();
|
|
||||||
label2.setText("Serie:");
|
|
||||||
panel1.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
|
||||||
serieField = new JTextField();
|
|
||||||
serieField.setText("");
|
|
||||||
panel1.add(serieField,
|
|
||||||
new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
|
||||||
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
|
||||||
agregarButton = new JButton();
|
agregarButton = new JButton();
|
||||||
agregarButton.setText("Agregar");
|
agregarButton.setText("Agregar");
|
||||||
panel1.add(agregarButton, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
panel1.add(agregarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
removerButton = new JButton();
|
||||||
|
removerButton.setText("Remover");
|
||||||
|
panel1.add(removerButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
null, 0, false));
|
null, 0, false));
|
||||||
final JPanel panel2 = new JPanel();
|
final JPanel panel2 = new JPanel();
|
||||||
panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
contentPane.add(panel2, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
contentPane.add(panel2, new GridConstraints(6, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
removerButton = new JButton();
|
|
||||||
removerButton.setText("Remover");
|
|
||||||
panel2.add(removerButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
|
||||||
null, 0, false));
|
|
||||||
guardarButton = new JButton();
|
guardarButton = new JButton();
|
||||||
guardarButton.setText("Guardar");
|
guardarButton.setText("Guardar");
|
||||||
panel2.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
panel2.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
@@ -152,30 +146,53 @@ public class ComprarSeleccionarPanel extends BasePanel {
|
|||||||
panel2.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
panel2.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
null, 0, false));
|
null, 0, false));
|
||||||
|
final JLabel label1 = new JLabel();
|
||||||
|
label1.setText("Distribuidor:");
|
||||||
|
contentPane.add(label1, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
contentPane.add(distribuidorCombo,
|
||||||
|
new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final JLabel label2 = new JLabel();
|
||||||
|
label2.setText("Cantidad:");
|
||||||
|
contentPane.add(label2, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
final JLabel label3 = new JLabel();
|
||||||
|
label3.setText("Libro:");
|
||||||
|
contentPane.add(label3, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
contentPane.add(librosCombo,
|
||||||
|
new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
cantidadSpinner = new JSpinner();
|
||||||
|
contentPane.add(cantidadSpinner,
|
||||||
|
new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), null, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUIComponents() {
|
private void createUIComponents() {
|
||||||
this.librosComboModel = new DefaultComboBoxModel<>();
|
this.librosComboModel = new DefaultComboBoxModel<>();
|
||||||
this.librosCombo = new JComboBox<>(this.librosComboModel);
|
this.librosCombo = new JComboBox<>(this.librosComboModel);
|
||||||
|
|
||||||
this.ejemplaresTableModel = new BaseTableModel<>(
|
this.distribuidorComboModel = new DefaultComboBoxModel<>();
|
||||||
new String[]{"ISBN", "Titulo", "Precio Referencial", "Serie"},
|
this.distribuidorCombo = new JComboBox<>(this.distribuidorComboModel);
|
||||||
|
|
||||||
|
this.libroTableModel = new BaseTableModel<>(
|
||||||
|
new String[]{"ISBN", "Titulo", "Precio Referencial"},
|
||||||
(rows, rowIndex, colIndex) -> {
|
(rows, rowIndex, colIndex) -> {
|
||||||
switch (colIndex) {
|
switch (colIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return rows.get(rowIndex).getLibro().getIsbn();
|
return rows.get(rowIndex).getIsbn();
|
||||||
case 1:
|
case 1:
|
||||||
return rows.get(rowIndex).getLibro().getTitulo();
|
return rows.get(rowIndex).getTitulo();
|
||||||
case 2:
|
case 2:
|
||||||
return rows.get(rowIndex).getLibro().getPrecioReferencia();
|
return rows.get(rowIndex).getPrecioReferencia();
|
||||||
case 3:
|
|
||||||
return rows.get(rowIndex).getSerie();
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.ejemplaresTable = new JTable(this.ejemplaresTableModel);
|
this.librosTable = new JTable(this.libroTableModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,4 +201,5 @@ public class ComprarSeleccionarPanel extends BasePanel {
|
|||||||
public JComponent $$$getRootComponent$$$() {
|
public JComponent $$$getRootComponent$$$() {
|
||||||
return contentPane;
|
return contentPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.comprar.ComprarSearchPanel">
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.orden_compra.OrdenCompraSearchPanel">
|
||||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="20" left="20" bottom="20" right="20"/>
|
<margin top="20" left="20" bottom="20" right="20"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="20" y="20" width="500" height="400"/>
|
<xy x="20" y="20" width="510" height="400"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
@@ -57,14 +57,14 @@
|
|||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="dd7c5" class="javax.swing.JButton" binding="comprarButton">
|
<component id="dd7c5" class="javax.swing.JButton" binding="crearButton">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Comprar"/>
|
<text value="Crear"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="5d466" class="javax.swing.JButton" binding="verButton">
|
<component id="5d466" class="javax.swing.JButton" binding="verButton">
|
||||||
@@ -74,7 +74,37 @@
|
|||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Ver Orden de Compra"/>
|
<text value="Ver"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="c18d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="c93c1" class="javax.swing.JButton" binding="cancelarButton">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Cancelar Orden"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="7d93a" class="javax.swing.JButton" binding="aceptarButton">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Recibir Orden"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package xyz.danielcortes.views.comprar;
|
package xyz.danielcortes.views.orden_compra;
|
||||||
|
|
||||||
import com.intellij.uiDesigner.core.GridConstraints;
|
import com.intellij.uiDesigner.core.GridConstraints;
|
||||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
@@ -13,17 +13,19 @@ import javax.swing.JTextField;
|
|||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import xyz.danielcortes.framework.BasePanel;
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
import xyz.danielcortes.framework.BaseTableModel;
|
import xyz.danielcortes.framework.BaseTableModel;
|
||||||
import xyz.danielcortes.models.Compra;
|
import xyz.danielcortes.models.OrdenCompra;
|
||||||
|
|
||||||
public class ComprarSearchPanel extends BasePanel {
|
public class OrdenCompraSearchPanel extends BasePanel {
|
||||||
|
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private JTextField searchField;
|
private JTextField searchField;
|
||||||
private JButton buscarButton;
|
private JButton buscarButton;
|
||||||
private JTable table;
|
private JTable table;
|
||||||
private BaseTableModel<Compra> model;
|
private BaseTableModel<OrdenCompra> model;
|
||||||
private JButton comprarButton;
|
private JButton crearButton;
|
||||||
private JButton verButton;
|
private JButton verButton;
|
||||||
|
private JButton cancelarButton;
|
||||||
|
private JButton aceptarButton;
|
||||||
|
|
||||||
{
|
{
|
||||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||||
@@ -32,6 +34,11 @@ public class ComprarSearchPanel extends BasePanel {
|
|||||||
this.$$$setupUI$$$();
|
this.$$$setupUI$$$();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JPanel getContentPane() {
|
||||||
|
return this.contentPane;
|
||||||
|
}
|
||||||
|
|
||||||
public JTextField getSearchField() {
|
public JTextField getSearchField() {
|
||||||
return this.searchField;
|
return this.searchField;
|
||||||
}
|
}
|
||||||
@@ -44,21 +51,24 @@ public class ComprarSearchPanel extends BasePanel {
|
|||||||
return this.table;
|
return this.table;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseTableModel<Compra> getModel() {
|
public BaseTableModel<OrdenCompra> getModel() {
|
||||||
return this.model;
|
return this.model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JButton getComprarButton() {
|
public JButton getCrearButton() {
|
||||||
return this.comprarButton;
|
return this.crearButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JButton getVerButton() {
|
public JButton getVerButton() {
|
||||||
return this.verButton;
|
return this.verButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public JButton getCancelarButton() {
|
||||||
public JPanel getContentPane() {
|
return this.cancelarButton;
|
||||||
return this.contentPane;
|
}
|
||||||
|
|
||||||
|
public JButton getAceptarButton() {
|
||||||
|
return this.aceptarButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,7 +79,7 @@ public class ComprarSearchPanel extends BasePanel {
|
|||||||
private void $$$setupUI$$$() {
|
private void $$$setupUI$$$() {
|
||||||
createUIComponents();
|
createUIComponents();
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(20, 20, 20, 20), -1, -1));
|
contentPane.setLayout(new GridLayoutManager(4, 1, new Insets(20, 20, 20, 20), -1, -1));
|
||||||
final JScrollPane scrollPane1 = new JScrollPane();
|
final JScrollPane scrollPane1 = new JScrollPane();
|
||||||
contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
@@ -94,35 +104,46 @@ public class ComprarSearchPanel extends BasePanel {
|
|||||||
contentPane.add(panel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
contentPane.add(panel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
comprarButton = new JButton();
|
crearButton = new JButton();
|
||||||
comprarButton.setText("Comprar");
|
crearButton.setText("Crear");
|
||||||
panel2.add(comprarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
panel2.add(crearButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
null, 0, false));
|
null, 0, false));
|
||||||
verButton = new JButton();
|
verButton = new JButton();
|
||||||
verButton.setText("Ver Orden de Compra");
|
verButton.setText("Ver");
|
||||||
panel2.add(verButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
panel2.add(verButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
null, 0, false));
|
null, 0, false));
|
||||||
|
final JPanel panel3 = new JPanel();
|
||||||
|
panel3.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
contentPane.add(panel3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
|
cancelarButton = new JButton();
|
||||||
|
cancelarButton.setText("Cancelar Orden");
|
||||||
|
panel3.add(cancelarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
aceptarButton = new JButton();
|
||||||
|
aceptarButton.setText("Recibir Orden");
|
||||||
|
panel3.add(aceptarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUIComponents() {
|
private void createUIComponents() {
|
||||||
this.model = new BaseTableModel<>(
|
this.model = new BaseTableModel<>(
|
||||||
new String[]{"Folio Factura", "Precio Neto", "Precio Bruto", "Distribuidor", "Fecha Compra", "Nº Libros Comprados"},
|
new String[]{"Distribuidor", "Nº Libros", "Estado", "Fecha Emision"},
|
||||||
(row, rowIndex, colIndex) -> {
|
(row, rowIndex, colIndex) -> {
|
||||||
switch (colIndex) {
|
switch (colIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return row.get(rowIndex).getFactura().getFolio();
|
|
||||||
case 1:
|
|
||||||
return row.get(rowIndex).getFactura().getPrecioNeto();
|
|
||||||
case 2:
|
|
||||||
return row.get(rowIndex).getFactura().getPrecioBruto();
|
|
||||||
case 3:
|
|
||||||
return row.get(rowIndex).getDistribuidor().getRut();
|
return row.get(rowIndex).getDistribuidor().getRut();
|
||||||
case 4:
|
case 1:
|
||||||
return row.get(rowIndex).getFactura().getFechaVenta();
|
return row.get(rowIndex).getLibros().size();
|
||||||
case 6:
|
case 2:
|
||||||
return row.get(rowIndex).getEjemplares().size();
|
return row.get(rowIndex).getEstado();
|
||||||
|
case 3:
|
||||||
|
return row.get(rowIndex).getInsertedAt();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.orden_compra.OrdenCompraViewPanel">
|
||||||
|
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="20" left="20" bottom="20" right="20"/>
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="441" height="455"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<vspacer id="13b47">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</vspacer>
|
||||||
|
<scrollpane id="3750c">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="400" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="2e370" class="javax.swing.JTable" binding="librosTable" custom-create="true">
|
||||||
|
<constraints/>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</scrollpane>
|
||||||
|
<hspacer id="32a85">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<hspacer id="bd6b7">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<grid id="ca98b" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="90c0e" class="javax.swing.JButton" binding="volverButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Volver"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<component id="76afc" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Distribuidor:"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="d0d25" class="javax.swing.JTextField" binding="distribuidorField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<editable value="false"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package xyz.danielcortes.views.orden_compra;
|
||||||
|
|
||||||
|
import com.intellij.uiDesigner.core.GridConstraints;
|
||||||
|
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||||
|
import com.intellij.uiDesigner.core.Spacer;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import xyz.danielcortes.framework.BasePanel;
|
||||||
|
import xyz.danielcortes.framework.BaseTableModel;
|
||||||
|
import xyz.danielcortes.models.Libro;
|
||||||
|
|
||||||
|
public class OrdenCompraViewPanel extends BasePanel {
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
private JTable librosTable;
|
||||||
|
private BaseTableModel<Libro> libroTableModel;
|
||||||
|
private JButton volverButton;
|
||||||
|
private JTextField distribuidorField;
|
||||||
|
|
||||||
|
{
|
||||||
|
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||||
|
// >>> IMPORTANT!! <<<
|
||||||
|
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||||
|
this.$$$setupUI$$$();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JPanel getContentPane() {
|
||||||
|
return this.contentPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTable getLibrosTable() {
|
||||||
|
return this.librosTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseTableModel<Libro> getLibroTableModel() {
|
||||||
|
return this.libroTableModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JButton getVolverButton() {
|
||||||
|
return this.volverButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JTextField getDistribuidorField() {
|
||||||
|
return this.distribuidorField;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
||||||
|
*
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
private void $$$setupUI$$$() {
|
||||||
|
createUIComponents();
|
||||||
|
contentPane = new JPanel();
|
||||||
|
contentPane.setLayout(new GridLayoutManager(5, 3, new Insets(20, 20, 20, 20), -1, -1));
|
||||||
|
final Spacer spacer1 = new Spacer();
|
||||||
|
contentPane.add(spacer1,
|
||||||
|
new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
|
||||||
|
null, null, 0, false));
|
||||||
|
final JScrollPane scrollPane1 = new JScrollPane();
|
||||||
|
contentPane.add(scrollPane1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false));
|
||||||
|
scrollPane1.setViewportView(librosTable);
|
||||||
|
final Spacer spacer2 = new Spacer();
|
||||||
|
contentPane.add(spacer2,
|
||||||
|
new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||||
|
null, null, 0, false));
|
||||||
|
final Spacer spacer3 = new Spacer();
|
||||||
|
contentPane.add(spacer3,
|
||||||
|
new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null,
|
||||||
|
null, null, 0, false));
|
||||||
|
final JPanel panel1 = new JPanel();
|
||||||
|
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
|
contentPane.add(panel1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
|
volverButton = new JButton();
|
||||||
|
volverButton.setText("Volver");
|
||||||
|
panel1.add(volverButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
|
||||||
|
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1),
|
||||||
|
null, 0, false));
|
||||||
|
final JLabel label1 = new JLabel();
|
||||||
|
label1.setText("Distribuidor:");
|
||||||
|
contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||||
|
distribuidorField = new JTextField();
|
||||||
|
distribuidorField.setEditable(false);
|
||||||
|
contentPane.add(distribuidorField,
|
||||||
|
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
|
||||||
|
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createUIComponents() {
|
||||||
|
|
||||||
|
this.libroTableModel = new BaseTableModel<>(
|
||||||
|
new String[]{"ISBN", "Titulo", "Precio Referencial"},
|
||||||
|
(rows, rowIndex, colIndex) -> {
|
||||||
|
switch (colIndex) {
|
||||||
|
case 0:
|
||||||
|
return rows.get(rowIndex).getIsbn();
|
||||||
|
case 1:
|
||||||
|
return rows.get(rowIndex).getTitulo();
|
||||||
|
case 2:
|
||||||
|
return rows.get(rowIndex).getPrecioReferencia();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.librosTable = new JTable(this.libroTableModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection ALL
|
||||||
|
*/
|
||||||
|
public JComponent $$$getRootComponent$$$() {
|
||||||
|
return contentPane;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user