{
    "type": "Ext.window.Window",
    "reference": {
        "name": "items",
        "type": "array"
    },
    "codeClass": null,
    "userConfig": {
        "autoShow": true,
        "height": null,
        "hidden": false,
        "width": null,
        "designer|userClassName": "importar",
        "designer|userAlias": "importar",
        "resizable": [
            "false"
        ],
        "layout": "fit",
        "header": false,
        "title": null,
        "modal": true
    },
    "designerId": "01b88942-ebff-44e9-bb9d-45367948d4ab",
    "cn": [
        {
            "type": "Ext.form.Panel",
            "reference": {
                "name": "items",
                "type": "array"
            },
            "codeClass": null,
            "userConfig": {
                "border": false,
                "frame": true,
                "itemId": "formImportar",
                "bodyPadding": 10,
                "title": null
            },
            "designerId": "bda1955e-a5c6-4ebf-911d-9267fea5df52",
            "cn": [
                {
                    "type": "Ext.form.FieldSet",
                    "reference": {
                        "name": "items",
                        "type": "array"
                    },
                    "codeClass": null,
                    "userConfig": {
                        "title": ""
                    },
                    "designerId": "e9921d51-24a3-40c4-9379-fef96307930e",
                    "cn": [
                        {
                            "type": "Ext.form.Label",
                            "reference": {
                                "name": "items",
                                "type": "array"
                            },
                            "codeClass": null,
                            "userConfig": {
                                "height": 14,
                                "html": "<h3><center>Seleccione el archivo generado por el biometrico...</center></h3>",
                                "text": null
                            },
                            "designerId": "5ceb6bba-9fc3-48bc-a1d8-7ba638d2c5ad"
                        },
                        {
                            "type": "Ext.form.field.File",
                            "reference": {
                                "name": "items",
                                "type": "array"
                            },
                            "codeClass": null,
                            "userConfig": {
                                "layout|anchor": "100%",
                                "margin": "15 0 0 0",
                                "width": null,
                                "fieldLabel": "Archivo",
                                "labelWidth": 62,
                                "name": "archivo",
                                "allowBlank": false
                            },
                            "designerId": "eea291ed-3085-49ba-a685-1fb8b75ce982"
                        },
                        {
                            "type": "Ext.toolbar.Toolbar",
                            "reference": {
                                "name": "items",
                                "type": "array"
                            },
                            "codeClass": null,
                            "userConfig": {
                                "margin": "15 0 0 0"
                            },
                            "designerId": "86cbb905-9208-48fa-8091-478f2d31321a",
                            "cn": [
                                {
                                    "type": "Ext.button.Button",
                                    "reference": {
                                        "name": "items",
                                        "type": "array"
                                    },
                                    "codeClass": null,
                                    "userConfig": {
                                        "layout|flex": null,
                                        "margin": "0 0 0 120",
                                        "icon": "img/disk.png",
                                        "text": "Aceptar"
                                    },
                                    "designerId": "9c059a10-46e3-4f13-9367-ef4fbc44ca1b",
                                    "cn": [
                                        {
                                            "type": "basicfunction",
                                            "reference": {
                                                "name": "items",
                                                "type": "array"
                                            },
                                            "codeClass": null,
                                            "userConfig": {
                                                "fn": "handler",
                                                "designer|params": [
                                                    "btn"
                                                ],
                                                "implHandler": [
                                                    "var win  = btn.up('window');\r",
                                                    "var form = win.down('form').getForm();\r",
                                                    "\r",
                                                    "// Tomamos CODIE desde la global que llenamos en el login\r",
                                                    "var codie = window.codieGlobal || '';\r",
                                                    "\r",
                                                    "if (!codie) {\r",
                                                    "    Ext.Msg.alert('Error', 'No se encontró el código de institución (CODIE).');\r",
                                                    "    return;\r",
                                                    "}\r",
                                                    "\r",
                                                    "if (form.isValid()) {\r",
                                                    "    form.submit({\r",
                                                    "        url    : 'controladores/SubirArchivo.php',  // tu PHP que procesa el CSV\r",
                                                    "        waitMsg: 'Subiendo el archivo...',\r",
                                                    "        params : { codie: codie },                 // << AQUÍ mandas CODIE al backend\r",
                                                    "        success: function (fp, o) {\r",
                                                    "            Ext.Msg.alert('Éxito', 'Archivo subido y procesado correctamente.');\r",
                                                    "            win.close();\r",
                                                    "        },\r",
                                                    "        failure: function (fp, o) {\r",
                                                    "            Ext.Msg.alert('Error', 'Hubo un error al procesar el archivo.');\r",
                                                    "        }\r",
                                                    "    });\r",
                                                    "}\r",
                                                    "\r",
                                                    ""
                                                ]
                                            },
                                            "designerId": "704b6ad3-72f5-4237-842f-14881663714c"
                                        }
                                    ]
                                },
                                {
                                    "type": "Ext.button.Button",
                                    "reference": {
                                        "name": "items",
                                        "type": "array"
                                    },
                                    "codeClass": null,
                                    "userConfig": {
                                        "layout|flex": null,
                                        "icon": "img/exit.png",
                                        "text": "Salir"
                                    },
                                    "designerId": "54e1b8b1-a44f-4d7f-8353-15a60bb1786f",
                                    "cn": [
                                        {
                                            "type": "basicfunction",
                                            "reference": {
                                                "name": "items",
                                                "type": "array"
                                            },
                                            "codeClass": null,
                                            "userConfig": {
                                                "fn": "handler",
                                                "designer|params": [
                                                    "button"
                                                ],
                                                "implHandler": [
                                                    "var win    = button.up('window');\r",
                                                    "win.close();\r",
                                                    ""
                                                ]
                                            },
                                            "designerId": "154b1c5f-01e5-4f3b-924c-b94567699dd9"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}