|
|
@@ -229,7 +229,7 @@ export class InvestmentProposalsComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
sendToReview(investmentProposalID: number, investmentCode: string) {
|
|
|
- async () => {
|
|
|
+ (async () => {
|
|
|
const { value: comentario } = await Swal.fire({
|
|
|
title: `<h3>Enviar a revisión propuesta de inversión ${investmentCode}</h3>`,
|
|
|
icon: "info",
|
|
|
@@ -237,47 +237,48 @@ export class InvestmentProposalsComponent implements OnInit {
|
|
|
input: "textarea",
|
|
|
showCancelButton: true,
|
|
|
confirmButtonText: "Enviar propuesta",
|
|
|
- cancelButtonText: "Cancelar"
|
|
|
+ cancelButtonText: "Cancelar",
|
|
|
// inputValidator: value => {
|
|
|
// if (!value) {
|
|
|
// return "Debe ingresar un comentario";
|
|
|
// }
|
|
|
// }
|
|
|
- });
|
|
|
|
|
|
- //if (comentario) {
|
|
|
- let reviewProposal = {
|
|
|
- id_inversion: investmentProposalID,
|
|
|
- step: "next",
|
|
|
- comentario: comentario
|
|
|
- };
|
|
|
-
|
|
|
- this.investmentsService
|
|
|
- .sendReviewProposalInvestment(reviewProposal)
|
|
|
- .subscribe(
|
|
|
- success => {
|
|
|
- if (success) {
|
|
|
- Swal.fire({
|
|
|
- allowOutsideClick: false,
|
|
|
- icon: "success",
|
|
|
- showCancelButton: false,
|
|
|
- title: "Exito",
|
|
|
- confirmButtonText: "La propuesta ha sido enviada a revisión"
|
|
|
- }).then(result => {
|
|
|
- Swal.close();
|
|
|
- window.location.reload();
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- Swal.fire({
|
|
|
- icon: "error",
|
|
|
- title: "Error al guardar",
|
|
|
- text: err.message
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
- };
|
|
|
+ preConfirm: comentario => {
|
|
|
+ let reviewProposal = {
|
|
|
+ id_inversion: investmentProposalID,
|
|
|
+ step: "next",
|
|
|
+ comentario: comentario
|
|
|
+ };
|
|
|
+
|
|
|
+ this.investmentsService
|
|
|
+ .sendReviewProposalInvestment(reviewProposal)
|
|
|
+ .subscribe(
|
|
|
+ success => {
|
|
|
+ if (success) {
|
|
|
+ Swal.fire({
|
|
|
+ allowOutsideClick: false,
|
|
|
+ icon: "success",
|
|
|
+ showCancelButton: false,
|
|
|
+ title: "Exito",
|
|
|
+ confirmButtonText: "La propuesta ha sido enviada a revisión"
|
|
|
+ }).then(result => {
|
|
|
+ Swal.close();
|
|
|
+ window.location.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ Swal.fire({
|
|
|
+ icon: "error",
|
|
|
+ title: "Error al guardar",
|
|
|
+ text: err.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })();
|
|
|
}
|
|
|
|
|
|
//Enviar a revision la propuesta de inversion
|
|
|
@@ -290,42 +291,41 @@ export class InvestmentProposalsComponent implements OnInit {
|
|
|
html: `<p style="text-align:left;">Comentario:</p>`,
|
|
|
showCancelButton: true,
|
|
|
confirmButtonText: "Finalizar",
|
|
|
- cancelButtonText: "Cancelar"
|
|
|
+ cancelButtonText: "Cancelar",
|
|
|
+ preConfirm: comentario => {
|
|
|
+ let reviewProposal = {
|
|
|
+ id_inversion: investmentProposalID,
|
|
|
+ step: "next",
|
|
|
+ comentario: comentario
|
|
|
+ };
|
|
|
+
|
|
|
+ this.investmentsService
|
|
|
+ .sendReviewProposalInvestment(reviewProposal)
|
|
|
+ .subscribe(
|
|
|
+ success => {
|
|
|
+ if (success) {
|
|
|
+ Swal.fire({
|
|
|
+ allowOutsideClick: false,
|
|
|
+ icon: "success",
|
|
|
+ showCancelButton: false,
|
|
|
+ title: "Exito",
|
|
|
+ confirmButtonText: "La propuesta ha sido finalizada"
|
|
|
+ }).then(result => {
|
|
|
+ Swal.close();
|
|
|
+ window.location.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ Swal.fire({
|
|
|
+ icon: "error",
|
|
|
+ title: "Error al guardar",
|
|
|
+ text: err.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
- //if (comentario) {
|
|
|
- let reviewProposal = {
|
|
|
- id_inversion: investmentProposalID,
|
|
|
- step: "next",
|
|
|
- comentario: comentario
|
|
|
- };
|
|
|
-
|
|
|
- this.investmentsService
|
|
|
- .sendReviewProposalInvestment(reviewProposal)
|
|
|
- .subscribe(
|
|
|
- success => {
|
|
|
- if (success) {
|
|
|
- Swal.fire({
|
|
|
- allowOutsideClick: false,
|
|
|
- icon: "success",
|
|
|
- showCancelButton: false,
|
|
|
- title: "Exito",
|
|
|
- confirmButtonText: "La propuesta ha sido finalizada"
|
|
|
- }).then(result => {
|
|
|
- Swal.close();
|
|
|
- window.location.href = "#/investment-proposals";
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- Swal.fire({
|
|
|
- icon: "error",
|
|
|
- title: "Error al guardar",
|
|
|
- text: err.message
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
- //}
|
|
|
})();
|
|
|
}
|
|
|
|