SyncMadeEasy/force-app/main/default/aura/ShopifyHeader/ShopifyHeaderController.js

67 lines
2.5 KiB
JavaScript

({
doinit : function(component, event, helper){
var action = component.get("c.getOrgId");
action.setCallback(this,function(response){
var returnvaue = response.getReturnValue();
if(response.getState() == 'SUCCESS' && returnvaue != ''){
component.set("v.OrgID",returnvaue);
}
});
$A.enqueueAction(action);
},
ContactSupport : function(component, event, helper) {
try{
var action = component.get('c.Checkemaildeliverability');
action.setCallback(this,function(response){
if(response.getState() =="SUCCESS" && response.getReturnValue() !=null){
var EmailDeliverbility = response.getReturnValue();
if(EmailDeliverbility == true || EmailDeliverbility == 'true' || EmailDeliverbility == 'true'){
component.set("v.OpenModel",EmailDeliverbility);
component.set("v.ShowForm",EmailDeliverbility);
}else{
window.open('mailto:support@syncmadeasy.com?Subject='+component.get("v.OrgID"),'_Top');
}
}
});
$A.enqueueAction(action);
}catch(e){
console.log(e);
}
},
closeModel : function(component,event, helper){
component.set("v.OpenModel",false);
},
onSubmit : function(component,event, helper){
var valid = false;
if(component.find('issuevalue').get("v.value") === undefined || component.find('issuevalue').get("v.value") == ''|| component.find('issuevalue').get("v.value") == null){
component.find("issuevalue").showHelpMessageIfInvalid();
}else{
valid = true;
}
if(valid ){
var action = component.get('c.SendingMailtoShopifySupport');
action.setParams({
"Issue":component.get("v.Issue")
});
action.setCallback(this,function(response){
var returnvalue1 = response.getReturnValue();
if(response.getState() == 'SUCCESS' && returnvalue1 != null ){
component.set("v.SendingMail",returnvalue1);
component.set("v.ShowForm",false);
}
});
$A.enqueueAction(action);
component.set("v.Issue",null);
//component.set("v.OpenModel",false);
}
},
})