Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
proyecto-estandar
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Israel Gutierrez Salazar
proyecto-estandar
Commits
aea53678
Commit
aea53678
authored
Jan 17, 2018
by
Alonso Moreno Postigo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EDIT] ListadoPersona arreglado
parent
95a1d028
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
3 deletions
+145
-3
persona.js
web/js/pages/persona.js
+0
-0
ubigeo.js
web/js/pages/ubigeo.js
+141
-0
index.jsp
web/vistas/index.jsp
+4
-3
No files found.
web/js/pages/persona.js
View file @
aea53678
This diff is collapsed.
Click to expand it.
web/js/pages/ubigeo.js
0 → 100644
View file @
aea53678
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$
(
document
).
ready
(
function
()
{
init
();
validarSelect
();
});
function
init
()
{
listarDepartamento
();
listarProvincia
();
listarDistrito
();
}
function
listarDepartamento
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'../UbigeoServlet?accion=listarDepartamento'
,
beforeSend
:
function
(
xhr
)
{
},
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
var
status
=
data
.
status
;
var
departamentos
=
data
.
data
.
departamentos
;
if
(
status
)
{
var
select_departamento
=
'<option value="0">[ SELECCIONE ]</option>'
;
for
(
var
i
in
departamentos
)
{
select_departamento
+=
'<option value="'
+
departamentos
[
i
].
codigoDepartamento
+
'">'
+
departamentos
[
i
].
nombreDepartamento
+
'</option>'
;
}
$
(
'#select_departamento'
).
html
(
select_departamento
);
$
(
'#select_departamento'
).
selectpicker
(
'refresh'
);
}
else
{
console
.
log
(
'no hay data prro'
);
}
},
complete
:
function
(
jqXHR
,
textStatus
)
{
}
});
}
function
listarProvincia
()
{
$
(
'#select_departamento'
).
on
(
'change'
,
function
()
{
var
json
=
{
codigoDepartamento
:
$
(
'#select_departamento'
).
val
()
};
$
.
ajax
({
type
:
'POST'
,
url
:
'../UbigeoServlet?accion=listarProvincia'
,
dataType
:
'json'
,
data
:
{
json
:
JSON
.
stringify
(
json
)},
beforeSend
:
function
(
xhr
)
{
},
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
var
status
=
data
.
status
;
var
provincias
=
data
.
data
.
provincias
;
if
(
status
)
{
var
select_provincia
=
'<option value="0">[ SELECCIONE ]</option>'
;
for
(
var
i
in
provincias
)
{
select_provincia
+=
'<option value="'
+
provincias
[
i
].
codigoProvincia
+
'">'
+
provincias
[
i
].
nombreProvincia
+
'</option>'
;
}
$
(
'#select_provincia'
).
html
(
select_provincia
);
$
(
'#select_provincia'
).
selectpicker
(
'refresh'
);
}
else
{
console
.
log
(
'no hay data prro'
);
}
},
complete
:
function
(
jqXHR
,
textStatus
)
{
}
});
});
}
function
listarDistrito
()
{
$
(
'#select_provincia'
).
on
(
'change'
,
function
()
{
var
json
=
{
codigoDepartamento
:
$
(
'#select_departamento'
).
val
(),
codigoProvincia
:
$
(
'#select_provincia'
).
val
()
};
$
.
ajax
({
type
:
'POST'
,
url
:
'../UbigeoServlet?accion=listarDistrito'
,
dataType
:
'json'
,
data
:
{
json
:
JSON
.
stringify
(
json
)},
beforeSend
:
function
(
xhr
)
{
},
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
var
status
=
data
.
status
;
var
distritos
=
data
.
data
.
distritos
;
if
(
status
)
{
var
select_distrito
=
'<option value="0">[ SELECCIONE ]</option>'
;
for
(
var
i
in
distritos
)
{
select_distrito
+=
'<option value="'
+
distritos
[
i
].
codigoDistrito
+
'">'
+
distritos
[
i
].
nombreDistrito
+
'</option>'
;
}
$
(
'#select_distrito'
).
html
(
select_distrito
);
$
(
'#select_distrito'
).
selectpicker
(
'refresh'
);
}
else
{
console
.
log
(
'no hay data prro'
);
}
},
complete
:
function
(
jqXHR
,
textStatus
)
{
}
});
});
}
function
validarSelect
()
{
$
(
'#select_departamento'
).
on
(
'change'
,
function
()
{
// debugger;
var
select_departamento
=
$
(
'#select_departamento'
).
val
();
if
(
select_departamento
===
'0'
)
{
$
(
'#select_provincia'
).
html
(
'<option value="0">[ SELECCIONE ]</option>'
);
$
(
'#select_distrito'
).
html
(
'<option value="0">[ SELECCIONE ]</option>'
);
$
(
'#select_provincia'
).
selectpicker
(
'refresh'
);
$
(
'#select_distrito'
).
selectpicker
(
'refresh'
);
}
else
{
$
(
'#select_provincia'
).
val
(
0
);
$
(
'#select_distrito'
).
val
(
0
);
$
(
'#select_distrito'
).
val
(
'<option value="0">[ SELECCIONE ]</option>'
);
$
(
'#select_provincia'
).
selectpicker
(
'refresh'
);
$
(
'#select_distrito'
).
selectpicker
(
'refresh'
);
}
});
}
\ No newline at end of file
web/vistas/index.jsp
View file @
aea53678
...
...
@@ -31,7 +31,7 @@
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
<label
class=
"text-uppercase"
>
departamento
<span
class=
"text-danger"
>
(*)
</span></label>
<select
class=
"bootstrap-select"
data-width=
"100%"
>
<select
id=
"select_departamento"
class=
"bootstrap-select"
data-width=
"100%"
>
<option
value=
"0"
>
[ SELECCIONE ]
</option>
</select>
</div>
...
...
@@ -39,7 +39,7 @@
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
<label
class=
"text-uppercase"
>
provincia
<span
class=
"text-danger"
>
(*)
</span></label>
<select
class=
"bootstrap-select"
data-width=
"100%"
>
<select
id=
"select_provincia"
class=
"bootstrap-select"
data-width=
"100%"
>
<option
value=
"0"
>
[ SELECCIONE ]
</option>
</select>
</div>
...
...
@@ -47,7 +47,7 @@
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
<label
class=
"text-uppercase"
>
distrito
<span
class=
"text-danger"
>
(*)
</span></label>
<select
class=
"bootstrap-select"
data-width=
"100%"
>
<select
id=
"select_distrito"
class=
"bootstrap-select"
data-width=
"100%"
>
<option
value=
"0"
>
[ SELECCIONE ]
</option>
</select>
</div>
...
...
@@ -75,6 +75,7 @@
<script
type=
"text/javascript"
src=
"../plantilla/assets/js/pages/form_bootstrap_select.js"
></script>
<!--js-->
<script
src=
"../js/pages/ubigeo.js"
type=
"text/javascript"
></script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment