X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/cd54ffa8f72331531d2fb4624c1259bbb023ce38..8f84e53bb26e345469f615091701a2d8f2c92273:/gui/gui.c diff --git a/gui/gui.c b/gui/gui.c index 06aee1c..0e8d344 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -6,14 +6,26 @@ #include #include "form.h" +#include "articulos.h" static void finish(int sig); - + +void editar_articulo(WINDOW *win, t_Articulo *articulo); + int main(int argc, char *argv[]) { /* initialize your non-curses data structures here */ WINDOW *mainwin; t_Form *form; + t_LstArticulos *articulos; + t_Articulo *art; + + if (argc != 2) { + printf("Modo de uso : %s archivo_de_articulos.xml\n", argv[0]); + return 1; + } + + articulos = art_cargar(argv[1]); /* Inicio Curses */ signal(SIGINT, finish); /* arrange interrupts to terminate */ @@ -53,28 +65,43 @@ int main(int argc, char *argv[]) /* Creo el formulario */ form = form_crear(mainwin); - form_agregar_widget(form, INPUT, "Nombre", 15, ""); - form_agregar_widget(form, RADIO, "Voto", 3, "Si,No,No Corresponde"); - form_agregar_widget(form, INPUT, "Datos", 30, ""); + form_agregar_widget(form, INPUT, "Numero de Articulo", 8, ""); form_ejecutar(form, 10, 10); - - delwin(mainwin); - endwin(); - /* Imprimo los datos! */ - printf("Datos Ingresados : \n"); - printf("\tNombre : %s\n", form_obtener_valor(form, "Nombre")); - printf("\tVoto : %s\n", form_obtener_valor(form, "Voto")); - printf("\tDatos : %s\n", form_obtener_valor(form, "Datos")); + art = art_obtener(articulos, form_obtener_valor(form, "Numero de Articulo")); + if (art != NULL) { + editar_articulo(mainwin, art); + } /* Libero el formulario */ + + delwin(mainwin); + endwin(); + form_destruir(form); + art_liberar(articulos); MD_Listar(); return 0; } +void editar_articulo(WINDOW *win, t_Articulo *articulo) +{ + t_Form *form; + form = form_crear(win); + form_agregar_widget(form, INPUT, "Numero de Artículo", 8, articulo->numero); + form_agregar_widget(form, INPUT, "Descripción", 50, articulo->desc); + form_agregar_widget(form, INPUT, "Presentación", 30, articulo->presentacion); + form_agregar_widget(form, INPUT, "Stock Actual", 8, articulo->existencia); + form_agregar_widget(form, INPUT, "PVU", 30, articulo->pvu); + form_agregar_widget(form, INPUT, "Stock Mínimo", 8, articulo->emin); + + form_ejecutar(form, 10, 10); + + form_destruir(form); +} + static void finish(int sig) { endwin();