提交 7ec5cea7 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 d048dc0d
...@@ -69,7 +69,6 @@ import AppColumnFormat from './components/app-column-format/app-column-format.vu ...@@ -69,7 +69,6 @@ import AppColumnFormat from './components/app-column-format/app-column-format.vu
import AppQuickGroup from './components/app-quick-group/app-quick-group.vue' import AppQuickGroup from './components/app-quick-group/app-quick-group.vue'
import AppGroupPicker from './components/app-group-picker/app-group-picker.vue' import AppGroupPicker from './components/app-group-picker/app-group-picker.vue'
import AppWFApproval from './components/app-wf-approval/app-wf-approval.vue' import AppWFApproval from './components/app-wf-approval/app-wf-approval.vue'
import Breadcrumb from './components/app-breadcrumb/app-breadcrumb.vue'
import AppTransfer from './components/app-transfer/app-transfer.vue' import AppTransfer from './components/app-transfer/app-transfer.vue'
import ContextMenuDrag from './components/context-menu-drag/context-menu-drag.vue' import ContextMenuDrag from './components/context-menu-drag/context-menu-drag.vue'
import AppOrgSelect from './components/app-org-select/app-org-select.vue' import AppOrgSelect from './components/app-org-select/app-org-select.vue'
...@@ -158,7 +157,6 @@ export const AppComponents = { ...@@ -158,7 +157,6 @@ export const AppComponents = {
v.component('app-group-select',AppGroupSelect); v.component('app-group-select',AppGroupSelect);
v.component('app-group-picker',AppGroupPicker); v.component('app-group-picker',AppGroupPicker);
v.component('app-wf-approval',AppWFApproval); v.component('app-wf-approval',AppWFApproval);
v.component('app-breadcrumb',Breadcrumb);
v.component('app-transfer',AppTransfer); v.component('app-transfer',AppTransfer);
v.component('context-menu-drag',ContextMenuDrag); v.component('context-menu-drag',ContextMenuDrag);
}, },
......
...@@ -62,36 +62,36 @@ export default class AccountServiceBase extends EntityService { ...@@ -62,36 +62,36 @@ export default class AccountServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listaccountsData:any = []; let contactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any);
if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){ if(contactsData && contactsData.length && contactsData.length > 0){
listaccountsData.forEach((item:any) => { contactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.contactid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listaccounts = listaccountsData; masterData.contacts = contactsData;
let contactsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
if(contactsData && contactsData.length && contactsData.length > 0){ if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){
contactsData.forEach((item:any) => { listaccountsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.contactid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.contacts = contactsData; masterData.listaccounts = listaccountsData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -101,8 +101,8 @@ export default class AccountServiceBase extends EntityService { ...@@ -101,8 +101,8 @@ export default class AccountServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts`,data,isloading); let res:any = await Http.getInstance().post(`/accounts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts)); this.tempStorage.setItem(tempContext.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
return res; return res;
} }
...@@ -117,40 +117,40 @@ export default class AccountServiceBase extends EntityService { ...@@ -117,40 +117,40 @@ export default class AccountServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listaccountsData:any = []; let contactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any);
if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){ if(contactsData && contactsData.length && contactsData.length > 0){
listaccountsData.forEach((item:any) => { contactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.contactid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listaccounts = listaccountsData; masterData.contacts = contactsData;
let contactsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
if(contactsData && contactsData.length && contactsData.length > 0){ if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){
contactsData.forEach((item:any) => { listaccountsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.contactid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.contacts = contactsData; masterData.listaccounts = listaccountsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}`,data,isloading); let res:any = await Http.getInstance().put(`/accounts/${context.account}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts)); this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
return res; return res;
} }
...@@ -178,8 +178,8 @@ export default class AccountServiceBase extends EntityService { ...@@ -178,8 +178,8 @@ export default class AccountServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/accounts/${context.account}`,isloading); let res:any = await Http.getInstance().get(`/accounts/${context.account}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts)); this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
return res; return res;
} }
...@@ -195,8 +195,8 @@ export default class AccountServiceBase extends EntityService { ...@@ -195,8 +195,8 @@ export default class AccountServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/accounts/getdraft`,isloading); let res:any = await Http.getInstance().get(`/accounts/getdraft`,isloading);
res.data.account = data.account; res.data.account = data.account;
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts)); this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
return res; return res;
} }
...@@ -250,40 +250,40 @@ export default class AccountServiceBase extends EntityService { ...@@ -250,40 +250,40 @@ export default class AccountServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listaccountsData:any = []; let contactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any);
if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){ if(contactsData && contactsData.length && contactsData.length > 0){
listaccountsData.forEach((item:any) => { contactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.contactid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listaccounts = listaccountsData; masterData.contacts = contactsData;
let contactsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_contacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
contactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_contacts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
if(contactsData && contactsData.length && contactsData.length > 0){ if(listaccountsData && listaccountsData.length && listaccountsData.length > 0){
contactsData.forEach((item:any) => { listaccountsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.contactid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.contacts = contactsData; masterData.listaccounts = listaccountsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/save`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts)); this.tempStorage.setItem(context.srfsessionkey+'_contacts',JSON.stringify(res.data.contacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
return res; return res;
} }
......
...@@ -77,36 +77,36 @@ export default class CampaignServiceBase extends EntityService { ...@@ -77,36 +77,36 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaigncampaigns = campaigncampaignsData; masterData.campaigncampaigns = campaigncampaignsData;
let campaignlistsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
campaignlistsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.campaignlists = campaignlistsData; masterData.leads = leadsData;
let leadsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){
leadsData.forEach((item:any) => { campaignlistsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -117,8 +117,8 @@ export default class CampaignServiceBase extends EntityService { ...@@ -117,8 +117,8 @@ export default class CampaignServiceBase extends EntityService {
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/campaigns`,data,isloading); let res:any = await Http.getInstance().post(`/campaigns`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(tempContext.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -148,41 +148,41 @@ export default class CampaignServiceBase extends EntityService { ...@@ -148,41 +148,41 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaigncampaigns = campaigncampaignsData; masterData.campaigncampaigns = campaigncampaignsData;
let campaignlistsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
campaignlistsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.campaignlists = campaignlistsData; masterData.leads = leadsData;
let leadsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){
leadsData.forEach((item:any) => { campaignlistsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading); let res:any = await Http.getInstance().put(`/campaigns/${context.campaign}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -211,8 +211,8 @@ export default class CampaignServiceBase extends EntityService { ...@@ -211,8 +211,8 @@ export default class CampaignServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading); let res:any = await Http.getInstance().get(`/campaigns/${context.campaign}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -229,8 +229,8 @@ export default class CampaignServiceBase extends EntityService { ...@@ -229,8 +229,8 @@ export default class CampaignServiceBase extends EntityService {
let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading); let res:any = await Http.getInstance().get(`/campaigns/getdraft`,isloading);
res.data.campaign = data.campaign; res.data.campaign = data.campaign;
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -273,41 +273,41 @@ export default class CampaignServiceBase extends EntityService { ...@@ -273,41 +273,41 @@ export default class CampaignServiceBase extends EntityService {
} }
} }
masterData.campaigncampaigns = campaigncampaignsData; masterData.campaigncampaigns = campaigncampaignsData;
let campaignlistsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
campaignlistsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.campaignlists = campaignlistsData; masterData.leads = leadsData;
let leadsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(campaignlistsData && campaignlistsData.length && campaignlistsData.length > 0){
leadsData.forEach((item:any) => { campaignlistsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading); let res:any = await Http.getInstance().post(`/campaigns/${context.campaign}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns)); this.tempStorage.setItem(context.srfsessionkey+'_campaigncampaigns',JSON.stringify(res.data.campaigncampaigns));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
......
...@@ -66,36 +66,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -66,36 +66,36 @@ export default class ContactServiceBase extends EntityService {
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && true){ if(context.account && true){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -120,42 +120,42 @@ export default class ContactServiceBase extends EntityService { ...@@ -120,42 +120,42 @@ export default class ContactServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -180,8 +180,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -180,8 +180,8 @@ export default class ContactServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/contacts`,data,isloading); let res:any = await Http.getInstance().post(`/contacts`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(tempContext.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -198,36 +198,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -198,36 +198,36 @@ export default class ContactServiceBase extends EntityService {
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -245,42 +245,42 @@ export default class ContactServiceBase extends EntityService { ...@@ -245,42 +245,42 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}`,data,isloading); let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -298,8 +298,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -298,8 +298,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/contacts/${context.contact}`,data,isloading); let res:any = await Http.getInstance().put(`/contacts/${context.contact}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -332,14 +332,14 @@ export default class ContactServiceBase extends EntityService { ...@@ -332,14 +332,14 @@ export default class ContactServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}`,isloading); let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
let res:any = await Http.getInstance().get(`/contacts/${context.contact}`,isloading); let res:any = await Http.getInstance().get(`/contacts/${context.contact}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -357,15 +357,15 @@ export default class ContactServiceBase extends EntityService { ...@@ -357,15 +357,15 @@ export default class ContactServiceBase extends EntityService {
if(context.account && true){ if(context.account && true){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/getdraft`,isloading); let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/getdraft`,isloading);
res.data.contact = data.contact; res.data.contact = data.contact;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
let res:any = await Http.getInstance().get(`/contacts/getdraft`,isloading); let res:any = await Http.getInstance().get(`/contacts/getdraft`,isloading);
res.data.contact = data.contact; res.data.contact = data.contact;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -382,36 +382,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -382,36 +382,36 @@ export default class ContactServiceBase extends EntityService {
public async Active(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Active(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -429,8 +429,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -429,8 +429,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/active`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/active`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -449,36 +449,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -449,36 +449,36 @@ export default class ContactServiceBase extends EntityService {
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -496,8 +496,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -496,8 +496,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/checkkey`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -516,36 +516,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -516,36 +516,36 @@ export default class ContactServiceBase extends EntityService {
public async Inactive(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Inactive(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -563,8 +563,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -563,8 +563,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/inactive`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/inactive`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -583,36 +583,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -583,36 +583,36 @@ export default class ContactServiceBase extends EntityService {
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -630,42 +630,42 @@ export default class ContactServiceBase extends EntityService { ...@@ -630,42 +630,42 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/save`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -683,8 +683,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -683,8 +683,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/save`,data,isloading); let res:any = await Http.getInstance().post(`/contacts/${context.contact}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
...@@ -701,36 +701,36 @@ export default class ContactServiceBase extends EntityService { ...@@ -701,36 +701,36 @@ export default class ContactServiceBase extends EntityService {
public async SetPrimary(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async SetPrimary(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact){ if(context.account && context.contact){
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = []; let leadsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any); leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){ if(leadsData && leadsData.length && leadsData.length > 0){
listcontactsData.forEach((item:any) => { leadsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.leadid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.listcontacts = listcontactsData; masterData.leads = leadsData;
let leadsData:any = []; let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_leads'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
leadsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_leads') as any); listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(leadsData && leadsData.length && leadsData.length > 0){ if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
leadsData.forEach((item:any) => { listcontactsData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.leadid = null; item.relationshipsid = null;
} }
delete item.srffrontuf; delete item.srffrontuf;
} }
}); });
} }
} }
masterData.leads = leadsData; masterData.listcontacts = listcontactsData;
let opportunitiesData:any = []; let opportunitiesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunities'),'undefined')){
opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any); opportunitiesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunities') as any);
...@@ -748,8 +748,8 @@ export default class ContactServiceBase extends EntityService { ...@@ -748,8 +748,8 @@ export default class ContactServiceBase extends EntityService {
masterData.opportunities = opportunitiesData; masterData.opportunities = opportunitiesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/setprimary`,data,isloading); let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/setprimary`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads)); this.tempStorage.setItem(context.srfsessionkey+'_leads',JSON.stringify(res.data.leads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities)); this.tempStorage.setItem(context.srfsessionkey+'_opportunities',JSON.stringify(res.data.opportunities));
return res; return res;
} }
......
...@@ -62,21 +62,6 @@ export default class IBizListServiceBase extends EntityService { ...@@ -62,21 +62,6 @@ export default class IBizListServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
...@@ -107,6 +92,21 @@ export default class IBizListServiceBase extends EntityService { ...@@ -107,6 +92,21 @@ export default class IBizListServiceBase extends EntityService {
} }
} }
masterData.listleads = listleadsData; masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
...@@ -131,9 +131,9 @@ export default class IBizListServiceBase extends EntityService { ...@@ -131,9 +131,9 @@ export default class IBizListServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/ibizlists`,data,isloading); let res:any = await Http.getInstance().post(`/ibizlists`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts)); this.tempStorage.setItem(tempContext.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads)); this.tempStorage.setItem(tempContext.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(tempContext.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(tempContext.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -149,21 +149,6 @@ export default class IBizListServiceBase extends EntityService { ...@@ -149,21 +149,6 @@ export default class IBizListServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
...@@ -194,6 +179,21 @@ export default class IBizListServiceBase extends EntityService { ...@@ -194,6 +179,21 @@ export default class IBizListServiceBase extends EntityService {
} }
} }
masterData.listleads = listleadsData; masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
...@@ -211,9 +211,9 @@ export default class IBizListServiceBase extends EntityService { ...@@ -211,9 +211,9 @@ export default class IBizListServiceBase extends EntityService {
masterData.campaignlists = campaignlistsData; masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/ibizlists/${context.ibizlist}`,data,isloading); let res:any = await Http.getInstance().put(`/ibizlists/${context.ibizlist}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts)); this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads)); this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -242,9 +242,9 @@ export default class IBizListServiceBase extends EntityService { ...@@ -242,9 +242,9 @@ export default class IBizListServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizlists/${context.ibizlist}`,isloading); let res:any = await Http.getInstance().get(`/ibizlists/${context.ibizlist}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts)); this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads)); this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -261,9 +261,9 @@ export default class IBizListServiceBase extends EntityService { ...@@ -261,9 +261,9 @@ export default class IBizListServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizlists/getdraft`,isloading); let res:any = await Http.getInstance().get(`/ibizlists/getdraft`,isloading);
res.data.ibizlist = data.ibizlist; res.data.ibizlist = data.ibizlist;
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts)); this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads)); this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
...@@ -292,21 +292,6 @@ export default class IBizListServiceBase extends EntityService { ...@@ -292,21 +292,6 @@ export default class IBizListServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let listaccountsData:any = []; let listaccountsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts'),'undefined')){
listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any); listaccountsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listaccounts') as any);
...@@ -337,6 +322,21 @@ export default class IBizListServiceBase extends EntityService { ...@@ -337,6 +322,21 @@ export default class IBizListServiceBase extends EntityService {
} }
} }
masterData.listleads = listleadsData; masterData.listleads = listleadsData;
let listcontactsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts'),'undefined')){
listcontactsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_listcontacts') as any);
if(listcontactsData && listcontactsData.length && listcontactsData.length > 0){
listcontactsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.listcontacts = listcontactsData;
let campaignlistsData:any = []; let campaignlistsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists'),'undefined')){
campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any); campaignlistsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_campaignlists') as any);
...@@ -354,9 +354,9 @@ export default class IBizListServiceBase extends EntityService { ...@@ -354,9 +354,9 @@ export default class IBizListServiceBase extends EntityService {
masterData.campaignlists = campaignlistsData; masterData.campaignlists = campaignlistsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/ibizlists/${context.ibizlist}/save`,data,isloading); let res:any = await Http.getInstance().post(`/ibizlists/${context.ibizlist}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts)); this.tempStorage.setItem(context.srfsessionkey+'_listaccounts',JSON.stringify(res.data.listaccounts));
this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads)); this.tempStorage.setItem(context.srfsessionkey+'_listleads',JSON.stringify(res.data.listleads));
this.tempStorage.setItem(context.srfsessionkey+'_listcontacts',JSON.stringify(res.data.listcontacts));
this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists)); this.tempStorage.setItem(context.srfsessionkey+'_campaignlists',JSON.stringify(res.data.campaignlists));
return res; return res;
} }
......
...@@ -69,21 +69,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -69,21 +69,6 @@ export default class OpportunityServiceBase extends EntityService {
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && true){ if(context.account && context.contact && true){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -114,22 +99,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -114,22 +99,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && true){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -145,6 +114,22 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -145,6 +114,22 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && true){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -175,21 +160,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -175,21 +160,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -205,6 +175,21 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -205,6 +175,21 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -235,6 +220,21 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -235,6 +220,21 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -244,9 +244,9 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -244,9 +244,9 @@ export default class OpportunityServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/opportunities`,data,isloading); let res:any = await Http.getInstance().post(`/opportunities`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(tempContext.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(tempContext.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
...@@ -262,21 +262,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -262,21 +262,6 @@ export default class OpportunityServiceBase extends EntityService {
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -307,15 +292,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -307,15 +292,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -331,6 +307,15 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -331,6 +307,15 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -361,14 +346,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -361,14 +346,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/contacts/${context.contact}/opportunities/${context.opportunity}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -384,6 +361,14 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -384,6 +361,14 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/contacts/${context.contact}/opportunities/${context.opportunity}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -414,11 +399,26 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -414,11 +399,26 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/opportunities/${context.opportunity}`,data,isloading); let res:any = await Http.getInstance().put(`/opportunities/${context.opportunity}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
...@@ -453,22 +453,22 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -453,22 +453,22 @@ export default class OpportunityServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}`,isloading); let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
if(context.contact && context.opportunity){ if(context.contact && context.opportunity){
let res:any = await Http.getInstance().get(`/contacts/${context.contact}/opportunities/${context.opportunity}`,isloading); let res:any = await Http.getInstance().get(`/contacts/${context.contact}/opportunities/${context.opportunity}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
let res:any = await Http.getInstance().get(`/opportunities/${context.opportunity}`,isloading); let res:any = await Http.getInstance().get(`/opportunities/${context.opportunity}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
...@@ -485,24 +485,24 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -485,24 +485,24 @@ export default class OpportunityServiceBase extends EntityService {
if(context.account && context.contact && true){ if(context.account && context.contact && true){
let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}/opportunities/getdraft`,isloading); let res:any = await Http.getInstance().get(`/accounts/${context.account}/contacts/${context.contact}/opportunities/getdraft`,isloading);
res.data.opportunity = data.opportunity; res.data.opportunity = data.opportunity;
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
if(context.contact && true){ if(context.contact && true){
let res:any = await Http.getInstance().get(`/contacts/${context.contact}/opportunities/getdraft`,isloading); let res:any = await Http.getInstance().get(`/contacts/${context.contact}/opportunities/getdraft`,isloading);
res.data.opportunity = data.opportunity; res.data.opportunity = data.opportunity;
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
let res:any = await Http.getInstance().get(`/opportunities/getdraft`,isloading); let res:any = await Http.getInstance().get(`/opportunities/getdraft`,isloading);
res.data.opportunity = data.opportunity; res.data.opportunity = data.opportunity;
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
...@@ -518,21 +518,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -518,21 +518,6 @@ export default class OpportunityServiceBase extends EntityService {
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -563,15 +548,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -563,15 +548,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -587,6 +563,15 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -587,6 +563,15 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -617,11 +602,26 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -617,11 +602,26 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/checkkey`,data,isloading); let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
return Http.getInstance().post(`/opportunities/${context.opportunity}/checkkey`,data,isloading); return Http.getInstance().post(`/opportunities/${context.opportunity}/checkkey`,data,isloading);
...@@ -639,21 +639,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -639,21 +639,6 @@ export default class OpportunityServiceBase extends EntityService {
public async Lose(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Lose(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -684,15 +669,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -684,15 +669,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/lose`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -708,6 +684,15 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -708,6 +684,15 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/lose`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -738,11 +723,26 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -738,11 +723,26 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/lose`,data,isloading); let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/lose`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
return Http.getInstance().post(`/opportunities/${context.opportunity}/lose`,data,isloading); return Http.getInstance().post(`/opportunities/${context.opportunity}/lose`,data,isloading);
...@@ -760,21 +760,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -760,21 +760,6 @@ export default class OpportunityServiceBase extends EntityService {
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -805,15 +790,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -805,15 +790,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -829,6 +805,15 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -829,6 +805,15 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -859,14 +844,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -859,14 +844,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -882,6 +859,14 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -882,6 +859,14 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -912,11 +897,26 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -912,11 +897,26 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/opportunities/${context.opportunity}/save`,data,isloading); let res:any = await Http.getInstance().post(`/opportunities/${context.opportunity}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
...@@ -932,21 +932,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -932,21 +932,6 @@ export default class OpportunityServiceBase extends EntityService {
public async Win(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Win(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.account && context.contact && context.opportunity){ if(context.account && context.contact && context.opportunity){
let masterData:any = {}; let masterData:any = {};
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -977,15 +962,6 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -977,15 +962,6 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/win`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunityproductsData:any = []; let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any); opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
...@@ -1001,6 +977,15 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -1001,6 +977,15 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.opportunityproducts = opportunityproductsData; masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/accounts/${context.account}/contacts/${context.contact}/opportunities/${context.opportunity}/win`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res;
}
if(context.contact && context.opportunity){
let masterData:any = {};
let opportunitycompetitorsData:any = []; let opportunitycompetitorsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors'),'undefined')){
opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any); opportunitycompetitorsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunitycompetitors') as any);
...@@ -1031,11 +1016,26 @@ export default class OpportunityServiceBase extends EntityService { ...@@ -1031,11 +1016,26 @@ export default class OpportunityServiceBase extends EntityService {
} }
} }
masterData.quotes = quotesData; masterData.quotes = quotesData;
let opportunityproductsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts'),'undefined')){
opportunityproductsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_opportunityproducts') as any);
if(opportunityproductsData && opportunityproductsData.length && opportunityproductsData.length > 0){
opportunityproductsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.opportunityproductid = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.opportunityproducts = opportunityproductsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/win`,data,isloading); let res:any = await Http.getInstance().post(`/contacts/${context.contact}/opportunities/${context.opportunity}/win`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors)); this.tempStorage.setItem(context.srfsessionkey+'_opportunitycompetitors',JSON.stringify(res.data.opportunitycompetitors));
this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes)); this.tempStorage.setItem(context.srfsessionkey+'_quotes',JSON.stringify(res.data.quotes));
this.tempStorage.setItem(context.srfsessionkey+'_opportunityproducts',JSON.stringify(res.data.opportunityproducts));
return res; return res;
} }
return Http.getInstance().post(`/opportunities/${context.opportunity}/win`,data,isloading); return Http.getInstance().post(`/opportunities/${context.opportunity}/win`,data,isloading);
......
...@@ -62,11 +62,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -62,11 +62,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let productsalesliteraturesData:any = []; let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any); competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){ if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){
productsalesliteraturesData.forEach((item:any) => { competitorsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -76,7 +76,7 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -76,7 +76,7 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.productsalesliteratures = productsalesliteraturesData; masterData.competitorsalesliteratures = competitorsalesliteraturesData;
let salesliteratureitemsData:any = []; let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any); salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
...@@ -92,11 +92,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -92,11 +92,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
} }
} }
masterData.salesliteratureitems = salesliteratureitemsData; masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = []; let productsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any); productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any);
if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){ if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){
competitorsalesliteraturesData.forEach((item:any) => { productsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -106,7 +106,7 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -106,7 +106,7 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.competitorsalesliteratures = competitorsalesliteraturesData; masterData.productsalesliteratures = productsalesliteraturesData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -116,9 +116,9 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -116,9 +116,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/salesliteratures`,data,isloading); let res:any = await Http.getInstance().post(`/salesliteratures`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(tempContext.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(tempContext.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures)); this.tempStorage.setItem(tempContext.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(tempContext.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(tempContext.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
return res; return res;
} }
...@@ -133,11 +133,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -133,11 +133,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let productsalesliteraturesData:any = []; let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any); competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){ if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){
productsalesliteraturesData.forEach((item:any) => { competitorsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -147,7 +147,7 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -147,7 +147,7 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.productsalesliteratures = productsalesliteraturesData; masterData.competitorsalesliteratures = competitorsalesliteraturesData;
let salesliteratureitemsData:any = []; let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any); salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
...@@ -163,11 +163,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -163,11 +163,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
} }
} }
masterData.salesliteratureitems = salesliteratureitemsData; masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = []; let productsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any); productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any);
if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){ if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){
competitorsalesliteraturesData.forEach((item:any) => { productsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -177,12 +177,12 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -177,12 +177,12 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.competitorsalesliteratures = competitorsalesliteraturesData; masterData.productsalesliteratures = productsalesliteraturesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/salesliteratures/${context.salesliterature}`,data,isloading); let res:any = await Http.getInstance().put(`/salesliteratures/${context.salesliterature}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures)); this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
return res; return res;
} }
...@@ -210,9 +210,9 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -210,9 +210,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/salesliteratures/${context.salesliterature}`,isloading); let res:any = await Http.getInstance().get(`/salesliteratures/${context.salesliterature}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures)); this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
return res; return res;
} }
...@@ -228,9 +228,9 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -228,9 +228,9 @@ export default class SalesLiteratureServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/salesliteratures/getdraft`,isloading); let res:any = await Http.getInstance().get(`/salesliteratures/getdraft`,isloading);
res.data.salesliterature = data.salesliterature; res.data.salesliterature = data.salesliterature;
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures)); this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
return res; return res;
} }
...@@ -258,11 +258,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -258,11 +258,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let productsalesliteraturesData:any = []; let competitorsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){
productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any); competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any);
if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){ if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){
productsalesliteraturesData.forEach((item:any) => { competitorsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -272,7 +272,7 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -272,7 +272,7 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.productsalesliteratures = productsalesliteraturesData; masterData.competitorsalesliteratures = competitorsalesliteraturesData;
let salesliteratureitemsData:any = []; let salesliteratureitemsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems'),'undefined')){
salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any); salesliteratureitemsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_salesliteratureitems') as any);
...@@ -288,11 +288,11 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -288,11 +288,11 @@ export default class SalesLiteratureServiceBase extends EntityService {
} }
} }
masterData.salesliteratureitems = salesliteratureitemsData; masterData.salesliteratureitems = salesliteratureitemsData;
let competitorsalesliteraturesData:any = []; let productsalesliteraturesData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures'),'undefined')){ if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures'),'undefined')){
competitorsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_competitorsalesliteratures') as any); productsalesliteraturesData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_productsalesliteratures') as any);
if(competitorsalesliteraturesData && competitorsalesliteraturesData.length && competitorsalesliteraturesData.length > 0){ if(productsalesliteraturesData && productsalesliteraturesData.length && productsalesliteraturesData.length > 0){
competitorsalesliteraturesData.forEach((item:any) => { productsalesliteraturesData.forEach((item:any) => {
if(item.srffrontuf){ if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){ if(Object.is(item.srffrontuf,"0")){
item.relationshipsid = null; item.relationshipsid = null;
...@@ -302,12 +302,12 @@ export default class SalesLiteratureServiceBase extends EntityService { ...@@ -302,12 +302,12 @@ export default class SalesLiteratureServiceBase extends EntityService {
}); });
} }
} }
masterData.competitorsalesliteratures = competitorsalesliteraturesData; masterData.productsalesliteratures = productsalesliteraturesData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/salesliteratures/${context.salesliterature}/save`,data,isloading); let res:any = await Http.getInstance().post(`/salesliteratures/${context.salesliterature}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures)); this.tempStorage.setItem(context.srfsessionkey+'_competitorsalesliteratures',JSON.stringify(res.data.competitorsalesliteratures));
this.tempStorage.setItem(context.srfsessionkey+'_salesliteratureitems',JSON.stringify(res.data.salesliteratureitems));
this.tempStorage.setItem(context.srfsessionkey+'_productsalesliteratures',JSON.stringify(res.data.productsalesliteratures));
return res; return res;
} }
......
...@@ -79,6 +79,14 @@ export class AppNavHistoryBase { ...@@ -79,6 +79,14 @@ export class AppNavHistoryBase {
*/ */
public readonly navIgnoreParameters: RegExp = new RegExp(/(srftabactivate|srftreeexpactivate)/); public readonly navIgnoreParameters: RegExp = new RegExp(/(srftabactivate|srftreeexpactivate)/);
/**
* 首页mate信息
*
* @type {*}
* @memberof AppNavHistoryBase
*/
public indexMeta: any = null;
/** /**
* 查找路由缓存 * 查找路由缓存
* *
......
...@@ -169,6 +169,8 @@ export class EditFormControlBase extends FormControlBase { ...@@ -169,6 +169,8 @@ export class EditFormControlBase extends FormControlBase {
if (data[this.appDeName]) { if (data[this.appDeName]) {
Object.assign(this.context, { [this.appDeName]: data[this.appDeName] }) Object.assign(this.context, { [this.appDeName]: data[this.appDeName] })
} }
// 更新上下文,当前数据视图数据
Object.assign(this.context, { [`src${this.appDeName}`]: { data } });
this.setFormEnableCond(data); this.setFormEnableCond(data);
this.fillForm(data, action); this.fillForm(data, action);
this.oldData = {}; this.oldData = {};
......
...@@ -438,6 +438,8 @@ export class GridControllerBase extends MDControlBase { ...@@ -438,6 +438,8 @@ export class GridControllerBase extends MDControlBase {
this.gridItemsModel = []; this.gridItemsModel = [];
this.items.forEach(() => { this.gridItemsModel.push(this.getGridRowModel()) }); this.items.forEach(() => { this.gridItemsModel.push(this.getGridRowModel()) });
this.$emit('load', this.items); this.$emit('load', this.items);
// 向上下文中填充当前数据
Object.assign(this.context, { [`srf${this.appDeName}`]: { items: this.items } });
// 设置默认选中 // 设置默认选中
setTimeout(() => { setTimeout(() => {
if (this.isSelectFirstDefault) { if (this.isSelectFirstDefault) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册