Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- componentDidMount() {
- if (this.props.elaborationModel) {
- this.frecuency = this.props.elaborationModel.promotion.frecuencia;
- this.fechaDesde = this.props.elaborationModel.promotion.fechaDesde;
- }
- this.loadData(this.frecuency, false, this.fechaDesde, null);
- this.props.setBusy(true);
- /*this.commercialStructureService.loadSearch(this.frecuency, false, this.fechaDesde, null).then(response => {
- if (!response.length && response.length !== 0) {
- var arr = new Array();
- arr.push(response);
- if (arr[0].message !== "") {
- this.dialogService.show("Mantenimiento EstructuraComercial", arr[0].message);
- }
- } else if (response.length === 0) {
- this.dialogService.show("Mantenimiento EstructuraComercial", "No se ha producido ninguna coincidencia con los criterios de busqueda.");
- }
- this.setState({
- items: response
- });
- this.props.setBusy(false);
- }).catch(error => {
- if (error.message !== "" && error.message.indexOf("timeout") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "La base de datos ha tardado mucho en responder.");
- } else if (error.message && error.message !== "" && error.message.indexOf("code 500") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "Ha habido un problema al intentar conctarse con el servidor. Intente cotactar con su administrador.");
- }
- this.props.setBusy(false);
- });*/
- }
- @autobind
- private loadData(frequency, sinPlan, fechaDesde, idEstanco) {
- this.props.setBusy(true);
- this.commercialStructureService.loadSearch(frequency, sinPlan, fechaDesde, idEstanco).then(response => {
- if (!response.length && response.length !== 0) {
- var arr = new Array();
- arr.push(response);
- if (arr[0].message !== "") {
- this.dialogService.show("Mantenimiento EstructuraComercial", arr[0].message);
- }
- } else if (response.length === 0) {
- this.dialogService.show("Mantenimiento EstructuraComercial", "No se ha producido ninguna coincidencia con los criterios de busqueda.");
- }
- this.setState({
- items: response
- });
- this.props.setBusy(false);
- }).catch(error => {
- if (error.message !== "" && error.message.indexOf("timeout") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "La base de datos ha tardado mucho en responder.");
- } else if (error.message && error.message !== "" && error.message.indexOf("code 500") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "Ha habido un problema al intentar conctarse con el servidor. Intente cotactar con su administrador.");
- }
- this.props.setBusy(false);
- });
- }
- @autobind
- private reload(sinPlan: boolean) {
- this.loadData(this.frecuency, sinPlan, this.fechaDesde, null);
- /*this.props.setBusy(true);
- this.commercialStructureService.loadSearch(this.frecuency, sinPlan, this.fechaDesde, null).then(response => {
- if (!response.length && response.length !== 0) {
- var arr = new Array();
- arr.push(response);
- if (arr[0].message !== "") {
- this.dialogService.show("Mantenimiento EstructuraComercial", arr[0].message);
- }
- } else if (response.length === 0) {
- this.dialogService.show("Mantenimiento EstructuraComercial", "No se ha producido ninguna coincidencia con los criterios de busqueda.");
- }
- this.setState({
- items: response
- });
- this.props.setBusy(false);
- }).catch(error => {
- if (error.message !== "" && error.message.indexOf("timeout") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "La base de datos ha tardado mucho en responder.");
- } else if (error.message && error.message !== "" && error.message.indexOf("code 500") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "Ha habido un problema al intentar conctarse con el servidor. Intente cotactar con su administrador.");
- }
- this.props.setBusy(false);
- });*/
- }
- @autobind
- private reloadEstanco(idEstanco) {
- return new Promise((resolve, reject) => { this.loadData(this.frecuency, false, this.fechaDesde, idEstanco); resolve() });
- /*this.commercialStructureService.loadSearch(this.frecuency, false, this.fechaDesde, idEstanco).then(response => {
- if (!response.length && response.length !== 0) {
- var arr = new Array();
- arr.push(response);
- if (arr[0].message !== "") {
- this.dialogService.show("Mantenimiento EstructuraComercial", arr[0].message);
- }
- } else if (response.length === 0) {
- this.dialogService.show("Mantenimiento EstructuraComercial", "No se ha producido ninguna coincidencia con los criterios de busqueda.");
- }
- this.setState({
- items: response
- });
- this.props.setBusy(false);
- }).catch(error => {
- if (error.message !== "" && error.message.indexOf("timeout") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "La base de datos ha tardado mucho en responder.");
- } else if (error.message && error.message !== "" && error.message.indexOf("code 500") !== -1) {
- this.dialogService.show("Mantenimiento Soportes", "Ha habido un problema al intentar conctarse con el servidor. Intente cotactar con su administrador.");
- }
- this.props.setBusy(false);
- });*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement