text:`Actualmente el plan <strong>${Utils.titleCase(data.plan)}</strong> no tiene cupo para completar la acción solicitada, por lo cual es necesario que compre más casillas`,
text:`Actualmente el plan <strong>${Utils.titleCase(data.plan)}</strong> no tiene cupo para completar la acción solicitada, por lo cual es necesario que compre más casillas`,
text:`Al presionar <strong>Aceptar</strong>, está autorizando la emisión de una factura por un total de <strong>${price}</strong> correspondiente a : <br> <ul class="list-buy-dialog"><li>Asunto: Cambio de Plan</li><li>Casilla: <strong>${account.name}</strong></li><li>Plan Original: <strong>${Utils.titleCase(this.currentPlan)}</strong></li><li>Nuevo Plan: <strong>${Utils.titleCase(data.plan)}</strong></li></ul>`,
text:`Al presionar <strong>Aceptar</strong>, está autorizando la emisión de una factura por un total de <strong>${price}</strong> correspondiente a : <br> <ul class="list-buy-dialog"><li>Asunto: Cambio de Plan</li><li>Casilla: <strong>${account.name}</strong></li><li>Plan Original: <strong>${Utils.titleCase(this.currentPlan)}</strong></li><li>Nuevo Plan: <strong>${Utils.titleCase(data.plan)}</strong></li></ul>`,
html:true,
html:true,
confirmButtonText:'Si, Cambiar Plan',
confirmButtonText:'Si, Cambiar Plan',
showLoaderOnConfirm:true,
showLoaderOnConfirm:true,
closeOnConfirm:false
closeOnConfirm:false
};
};
Utils.alertToBuy((isConfirmed)=>{
Utils.alertToBuy((isConfirmed)=>{
if(isConfirmed){
if(isConfirmed){
constitem={};
constitem={};
item.basic={
item.basic={
type:'Producto',
type:'Producto',
quantity:1,
quantity:1,
price:prices[data.plan],
price:prices[data.plan],
description:`Cambio de plan de la casilla: ${account.name} de ${this.currentPlan} a ${data.plan}`,
description:`Cambio de plan de la casilla: ${account.name} de ${this.currentPlan} a ${data.plan}`,
id:data.cosId
id:data.cosId
};
};
request.items=item;
request.items=item;
constrequestObject=JSON.stringify(request);
constrequestObject=JSON.stringify(request);
Client.makeSale(requestObject,()=>{
Client.makeSale(requestObject,()=>{
Utils.alertToBuy((isConfirmed)=>{
Utils.alertToBuy((isConfirmed)=>{
if(isConfirmed){
if(isConfirmed){
constenabledAccounts=this.state.enabledAccounts;
constenabledAccounts=this.state.enabledAccounts;
enabledAccounts.forEach((plan)=>{
enabledAccounts.forEach((plan)=>{
if(plan.cosId===data.cosId){
if(plan.cosId===data.cosId){
plan.enabled++;
plan.enabled++;
plan.total++;
plan.total++;
currentEvent.target.checked=true;
currentEvent.target.checked=true;
}
}
});
});
this.setState({
this.setState({
enabledAccounts,
enabledAccounts,
zimbraCOSId:data.cosId
zimbraCOSId:data.cosId
});
});
}
}
},{
},{
title:'Cambio de Plan',
title:'Cambio de Plan',
text:'Su compra se ha realizado con éxito.',
text:'Su compra se ha realizado con éxito.',
showCancelButton:false,
showCancelButton:false,
confirmButtonColor:'#4EA5EC',
confirmButtonColor:'#4EA5EC',
confirmButtonText:'Muy bien',
confirmButtonText:'Muy bien',
type:'success'
type:'success'
});
},(error)=>{
Utils.alertToBuy(()=>{
returnnull;
},{
title:'Error',
text:error.message||error.error.message||'Ha ocurrido un error desconocido.',
showCancelButton:false,
confirmButtonColor:'#4EA5EC',
confirmButtonText:'Entiendo',
type:'error',
closeOnConfirm:true
});
});
});
}
},(error)=>{
},options);
Utils.alertToBuy(()=>{
},(error)=>{
returnnull;
returnEventStore.emitToast({
},{
type:'error',
title:'Error',
title:'Compras - Precios',
text:error.message||error.error.message||'Ha ocurrido un error desconocido.',
body:error.message||'Ha ocurrido un error al intentar obtener los precios, vuelva a intentarlo por favor.',
showCancelButton:false,
options:{
confirmButtonColor:'#4EA5EC',
timeOut:4000,
confirmButtonText:'Entiendo',
extendedTimeOut:2000,
type:'error',
closeButton:true
closeOnConfirm:true
}
});
});
});
}
},options);
},(error)=>{
returnEventStore.emitToast({
type:'error',
title:'Compras - Precios',
body:error.message||'Ha ocurrido un error al intentar obtener los precios, vuelva a intentarlo por favor.',