Refactorizar productos
This commit is contained in:
parent
a515246bcb
commit
52169cb77c
|
@ -171,12 +171,12 @@ class Folios(BaseModel):
|
|||
|
||||
class Categorias(BaseModel):
|
||||
categoria = TextField()
|
||||
id_padre = IntegerField(default=0)
|
||||
padre = ForeignKeyField('self', null=True, related_name='hijos')
|
||||
|
||||
class Meta:
|
||||
order_by = ('categoria',)
|
||||
indexes = (
|
||||
(('categoria', 'id_padre'), True),
|
||||
(('categoria', 'padre'), True),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -5,18 +5,22 @@ var toolbar_products = [
|
|||
autowidth: true, icon: "plus"},
|
||||
{view: "button", id: "cmd_edit_product", label: "Editar", type: "iconButton",
|
||||
autowidth: true, icon: "pencil"},
|
||||
{view: "button", id: "cmd_delete_product", label: "Eliminar", type: "iconButton",
|
||||
autowidth: true, icon: "minus"},
|
||||
];
|
||||
{view: "button", id: "cmd_delete_product", label: "Eliminar",
|
||||
type: "iconButton", autowidth: true, icon: "minus"},
|
||||
]
|
||||
|
||||
|
||||
var grid_products_cols = [
|
||||
{ id:"id", header:"ID", width: 75},
|
||||
{ id:"key", header: ["Clave", {content: "textFilter"}], width: 100, sort:"string" },
|
||||
{ id:"description", header: ["Descripción", {content: "textFilter"}], fillspace:true, sort:"string" },
|
||||
{ id:"unidad", header: ["Unidad", {content: "selectFilter"}], width: 150, sort:"string" },
|
||||
{ id:"price", header: ["Precio", {content: "numberFilter"}], width: 150, sort:"int", format: webix.i18n.priceFormat, css: "cell_right" },
|
||||
];
|
||||
{ id: "id", header: "ID", width: 75},
|
||||
{ id: "key", header: ["Clave", {content: "textFilter"}], width: 100,
|
||||
sort:"string" },
|
||||
{ id: "description", header: ["Descripción", {content: "textFilter"}],
|
||||
fillspace:true, sort:"string" },
|
||||
{ id: "unidad", header: ["Unidad", {content: "selectFilter"}], width: 150,
|
||||
sort:"string" },
|
||||
{ id: "price", header: ["Precio", {content: "numberFilter"}], width: 150,
|
||||
sort:"int", format: webix.i18n.priceFormat, css: "cell_right" },
|
||||
]
|
||||
|
||||
|
||||
var grid_products = {
|
||||
|
@ -28,25 +32,62 @@ var grid_products = {
|
|||
resizeColumn: true,
|
||||
headermenu: true,
|
||||
columns: grid_products_cols,
|
||||
//~ onClick:{
|
||||
//~ cmd_edit_parter: cmd_edit_partner_click,
|
||||
//~ },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//~ webix.ui({
|
||||
//~ view:"combo", suggest:{body:{view:"tree", data:[]}},
|
||||
//~ on:{onChange:function(newv, oldv){
|
||||
//~ webix.message("Value changed from: "+oldv+" to: "+newv);
|
||||
//~ }}, width:300
|
||||
//~ });
|
||||
|
||||
var controls_generals = [
|
||||
{view: "textarea", id: "description", name: "description", height: 200, label: "Descripción", required: true, labelPosition: "top", invalidMessage: "La Descripción es requerida" },
|
||||
{cols: [{view: "text", id: "unidad", name: "unidad", label: "Unidad", width: 300, labelWidth: 130, labelAlign: "right", required: true, invalidMessage: "La Unidad es requerida" },{}]},
|
||||
{cols: [{view: "search", type: "text", id: "price", name: "price", label: "Valor Unitario", width: 300, labelWidth: 130, labelAlign: "right", required: true, icon:"calculator", invalidMessage: "Captura un valor númerico", inputAlign:"right" },{}]},
|
||||
{view: 'checkbox', id: 'es_activo_producto', name: 'es_activo_producto',
|
||||
label: 'Activo: ', value: true,
|
||||
bottomLabel: 'Se recomienda solo desactivar y no eliminar'},
|
||||
{cols: [
|
||||
{view: 'combo', id: 'categoria', name: 'categoria',
|
||||
label: 'Categoría', labelPosition: 'top',
|
||||
suggest: {body: {view: 'tree', data:[]}}},
|
||||
{view: 'text', id: 'clave', name: 'clave', label: 'Clave',
|
||||
labelPosition: 'top', readonly: true, required: true},
|
||||
{view: 'checkbox', label: 'Automática', labelPosition: 'top',
|
||||
value: true, maxWidth: 80},
|
||||
{view: 'text', id: 'clave_sat', name: 'clave_sat', label: 'Clave SAT',
|
||||
labelPosition: 'top', required: true},
|
||||
]},
|
||||
{view: 'text', id: 'codigo_barras', name: 'codigo_barras',
|
||||
label: 'Código de Barras', labelPosition: 'top'},
|
||||
{view: "textarea", id: "description", name: "description", height: 200,
|
||||
label: "Descripción", required: true, labelPosition: "top",
|
||||
invalidMessage: "La Descripción es requerida" },
|
||||
{cols: [{view: "text", id: "unidad", name: "unidad", label: "Unidad",
|
||||
width: 300, labelWidth: 130, labelAlign: "right", required: true,
|
||||
invalidMessage: "La Unidad es requerida" },{}]},
|
||||
{cols: [{view: "search", type: "text", id: "price", name: "price",
|
||||
label: "Valor Unitario", width: 300, labelWidth: 130,
|
||||
labelAlign: "right", required: true, icon: "calculator",
|
||||
invalidMessage: "Captura un valor númerico", inputAlign:"right" },{}]},
|
||||
{cols: [
|
||||
{view: 'checkbox', id: 'inventario', name: 'inventario',
|
||||
label: 'Inventario', labelAlign: 'right', labelWidth: 130},
|
||||
{view: 'counter', id: 'existencia', name: 'existencia',
|
||||
label: 'Existencia', step: 5, value: 0, min: 0, disabled: true},
|
||||
{view: 'counter', id: 'minimo', name: 'minimo',
|
||||
label: 'Mínimo', step: 5, value: 0, min: 0, disabled: true},
|
||||
]},
|
||||
{view: 'text', id: 'tags_producto', name: 'tags_producto', label: 'Etiquetas',
|
||||
tooltip: 'Utiles para filtrados rápidos. Separa por comas.'},
|
||||
]
|
||||
|
||||
|
||||
var controls_products = [
|
||||
{
|
||||
view: "tabview",
|
||||
tabbar: { options: ["Generales"]}, animate: true,
|
||||
tabbar: { options: ["Datos"]}, animate: true,
|
||||
cells: [
|
||||
{id: "Generales", rows: controls_generals},
|
||||
{id: "Datos", rows: controls_generals},
|
||||
]
|
||||
},
|
||||
{rows: [
|
||||
|
@ -57,7 +98,7 @@ var controls_products = [
|
|||
{}]
|
||||
},
|
||||
]}
|
||||
];
|
||||
]
|
||||
|
||||
|
||||
var form_product = {
|
||||
|
@ -73,8 +114,8 @@ var form_product = {
|
|||
unidad: function(value){ return value.trim() != ""; },
|
||||
price: function(value){ return value.trim() != ""; },
|
||||
}
|
||||
}]
|
||||
};
|
||||
}],
|
||||
}
|
||||
|
||||
|
||||
var multi_products = {
|
||||
|
@ -86,8 +127,8 @@ var multi_products = {
|
|||
grid_products,
|
||||
]},
|
||||
{id: "product_new", rows:[form_product, {}]}
|
||||
]
|
||||
};
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
var app_products = {
|
||||
|
@ -95,7 +136,7 @@ var app_products = {
|
|||
rows:[
|
||||
{view: "template", id: "th_products", type: "header", template:"Administración de Productos" },
|
||||
multi_products
|
||||
]
|
||||
};
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue