Advertisement
f1lam3ntx0

new settings backup

Jul 5th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.65 KB | None | 0 0
  1.  
  2. smartroomv3
  3. >>>>>>>>>>>>>>>>>>>
  4. 4001------- >
  5. function handleSmartRoomSettingNewUI() {
  6. $('#popupRoomSettingsSpinner').show();
  7. $('#srd-popup-RoomSettings-NewUI').show();
  8. panelData = { "smartRoomId": '{!JSENCODE(workspaceId)}' }
  9. $Lightning.use(_lightningComponentPrefix + ":leftPanelApp", function ()
  10. {
  11. $Lightning.createComponent(_lightningComponentPrefix + ":roomSettings",
  12. panelData,
  13. "srd-popup-RoomSettings-NewUI",
  14. function (cmp)
  15. {
  16. console.log('lwc loaded');
  17. $('#popupRoomSettingsSpinner').hide();
  18. //closeModalDialog('roomSettingsModal');
  19. }
  20. );
  21. });
  22.  
  23.  
  24. }
  25. >>>>>>>>>>>>>>>>>>>>>>>
  26. 4503 --- >
  27. div style="display:none; min-height: 300px;" class="slds-chat-list slds-border_bottom slds-scrollable_y slds-p-horizontal_large slds-p-bottom_large"
  28. id="srd-popup-RoomSettings-NewUI">
  29. <div class="slds-spinner_container" id="popupRoomSettingsSpinner" style="display: none;">
  30. <div class="slds-spinner--brand slds-spinner slds-spinner--small" aria-hidden="false" role="alert">
  31. <div class="slds-spinner__dot-a"></div>
  32. <div class="slds-spinner__dot-b"></div>
  33. </div>
  34. </div>
  35. </div>
  36. >>>>>>>>>>>>>>>
  37. smartroomheader
  38. 189 --
  39. <a onclick="handleSmartRoomSettingNewUI()" title="Settings"> Settings </a>
  40.  
  41. >>>>>>>>>>>>>>>>>>>>
  42. workspaceservice (last)
  43. // Harshit Saxena SCB-18639 {This get the intial data for the settings modal for general and community SmartRoom}
  44. @AuraEnabled
  45. public static String getInitialRoomSettings(String ajaxData){
  46.  
  47. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  48. Map<String,Object> response = new Map<String,Object>();
  49. System.debug('Testing the request---->'+requestData);
  50. // Boolean oneToOneDiscussion = CommonUtils.getDataRequestAsBoolean('OneToOneDiscussion',requestData);
  51. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  52. //String roomName = CommonUtils.getDataRequestAsString('roomName', requestData);
  53. Workspace__c workspaceObj=[SELECT Id, Name,IsEnhancedDiscussion__c,Type__c,Discussion_Type__c,Account__c,Account__r.Name, OwnerId,Language__c,CreatedById, Extra_Attribute2__c, Team_Display_Name__c FROM Workspace__c where id =:workspaceId];
  54. String colType = '';
  55. String AccountName= '';
  56. String AccountDisplayname ='';
  57. Boolean IsAccountMapped ;
  58. String roomType = '';
  59. String roomName = '';
  60. String teamDisplayName = '';
  61.  
  62. if(workspaceObj != null )
  63. {
  64. roomType = workspaceObj.Type__c ;
  65. roomName = workspaceObj.Name ;
  66. if(workspaceObj.type__c == Constants.ROOM_TYPE_SOLUTION )
  67. {
  68. colType = workspaceObj.Discussion_Type__c; // value = public, partial , private.
  69. }
  70. else
  71. {
  72. if(workspaceObj.Account__c !=null & workspaceObj.Account__r.Name !=null )
  73. {
  74. IsAccountMapped = true ;
  75. AccountName = workspaceObj.Account__r.Name ;
  76. AccountDisplayname = workspaceObj.Extra_Attribute2__c;
  77. teamDisplayName = workspaceObj.Team_Display_Name__c;
  78.  
  79. }
  80. }
  81. }
  82. response.put('roomType',roomType);
  83. response.put('colType',colType);
  84. response.put('IsAccountMapped',IsAccountMapped);
  85. response.put('hasError',false);
  86. response.put('AccountName', AccountName);
  87. response.put('AccountDisplayname', AccountDisplayname);
  88. response.put('roomName', roomName);
  89. response.put('teamDisplayName', teamDisplayName);
  90.  
  91.  
  92.  
  93.  
  94.  
  95. return JSON.serializePretty(response);
  96. }
  97. //! Harshit Saxena SCB-18639 {This method save the community type room settings. It sets the value of the collaboration setting on the basis of the all, none , account }
  98. @AuraEnabled
  99. public static string saveCommunityRoomSettings(String ajaxData){
  100. Map<String,Object> response = new Map<String,Object>();
  101. try {
  102. String discussionValue = '' ;
  103. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  104.  
  105. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  106. String colType = CommonUtils.getDataRequestAsString('Type', requestData);
  107. if(colType !=null)
  108. {
  109. if (colType == 'isAccount')
  110. {
  111. discussionValue = 'PARTIAL';
  112. System.debug(discussionValue);
  113. System.debug(colType);
  114. }
  115. else if (colType == 'isAll')
  116. {
  117. discussionValue = 'PUBLIC';
  118. System.debug(discussionValue);
  119. System.debug(colType);
  120. }
  121. else if (colType == 'isNone')
  122. {
  123. discussionValue = 'PRIVATE';
  124. System.debug(discussionValue);
  125. System.debug(colType);
  126. }
  127.  
  128.  
  129. else
  130. {
  131. discussionValue = colType;
  132. System.debug(discussionValue);
  133. System.debug(colType);
  134. }
  135. }
  136. else{
  137. System.debug('value is null ');
  138. }
  139. List<Workspace__c> workspaceObj=[SELECT Id, Discussion_Type__c FROM Workspace__c WHERE Id =: workspaceId ];
  140. if(workspaceObj.size() > 0 ){
  141. System.debug(discussionValue);
  142. System.debug(colType);
  143. for(Workspace__c wrkObj : workspaceObj){
  144. wrkObj.Discussion_Type__c = discussionValue ;
  145. }
  146. System.debug(workspaceObj);
  147. UPDATE workspaceObj ;
  148. }
  149. System.debug(discussionValue);
  150. System.debug(colType);
  151. response.put('hasError',false);
  152. response.put('discussionValue',discussionValue);
  153. System.debug(workspaceObj);
  154.  
  155.  
  156. } catch (Exception e) {
  157. response.put('hasError',true);
  158. response.put('Message',e.getMessage());
  159. }
  160. return JSON.serializePretty(response);
  161. }
  162. //! Harshit Saxena SCB-18639 {It Seach the account to be mapped to the specific SmartRoom and it is only visible in general type room}
  163. @AuraEnabled
  164. public static String searchMapAccount(String workspaceId, String keyword , String ajaxData)
  165. {
  166. Map<String,Object> response = new Map<String,Object>();
  167. try {
  168.  
  169. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  170. String searchString = CommonUtils.getDataRequestAsString('keyword', requestData);
  171. if(searchString != null)
  172. {
  173. String str = '%' + searchString + '%';
  174. List<Workspace__c> workspaceObj = [ SELECT Id,Account__r.name FROM Workspace__c WHERE Account__r.name LIKE: str];
  175. }
  176.  
  177. else
  178. {
  179. System.debug('Empty search keyword');
  180. }
  181.  
  182. }
  183. catch (Exception e)
  184. {
  185. response.put('hasError', true);
  186. response.put('Message',e.getMessage());
  187. }
  188. // return new List<mapWrapper>() ;
  189. return JSON.serializePretty(response);
  190.  
  191. }
  192. //! Harshit Saxena SCB-18639 {It save the genreal room settings }
  193. @AuraEnabled
  194. public static String saveGeneralRoomSettings(String ajaxData)
  195. {
  196. Map<String,Object> response = new Map<String,Object>();
  197. try {
  198. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  199.  
  200. System.debug('Testing the request---->'+requestData);
  201. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  202. String mappedAccId = CommonUtils.getDataRequestAsString('accId', requestData);
  203. String accMapped = CommonUtils.getDataRequestAsString('accMapped', requestData);
  204. //String colType = CommonUtils.getDataRequestAsString('Type', requestData);
  205. Workspace__c workspaceObj;
  206. try
  207. {
  208. Workspace__c workspaceObjBase = [SELECT Id,Account__c FROM Workspace__c WHERE id=: workspaceId];
  209. workspaceObj= (Workspace__c)Utils.filterRecords(workspaceObjBase);
  210.  
  211. }
  212. catch(Exception e)
  213. {
  214. response.put('hasError', true);
  215. response.put('Message', e.getMessage());
  216. return JSON.serializePretty(response);
  217. }
  218.  
  219. if(accMapped == 'accountMapped')
  220. {
  221. workspaceObj.Account__c = mappedAccId;
  222. try
  223. {
  224. DBQueryUtils.updateObjects(workspaceObj);
  225. response.put('hasError', false);
  226. response.put('Message', 'Operation successful');
  227. response.put('accMapped', true);
  228. //return JSON.serializePretty(response);
  229.  
  230. }
  231. catch(Exception e1)
  232. {
  233. response.put('hasError', true);
  234. response.put('Message', e1.getMessage());
  235. //return JSON.serializePretty(response);
  236. }
  237. }
  238. else {
  239. response.put('accMapped', 'noAccountMapped');
  240.  
  241. }
  242.  
  243. }
  244. catch(Exception e1)
  245. {
  246. response.put('hasError', true);
  247. response.put('Message', e1.getMessage());
  248.  
  249.  
  250. }
  251. return JSON.serializePretty(response);
  252. }
  253. /* @AuraEnabled
  254. public static Map<String,Object> getMappedAccountDetails(String workspaceId){
  255. Map<String,Object> response = new Map<String,Object>();
  256. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  257. response.put('isMapped', true);
  258. response.put('Message', );
  259.  
  260.  
  261.  
  262. }
  263.  
  264. @AuraEnabled
  265. public static String showMappedAccount(String ajaxData){
  266. Map<String,Object> response = new Map<String,Object>();
  267. String mappedAcc= '';
  268. try{
  269. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  270. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  271. String mappedAccId = CommonUtils.getDataRequestAsString('accId', requestData);
  272. Workspace__c workspaceObj;
  273. workspaceObj = [SELECT Id,Account__c,Account__r.Name FROM Workspace__c where id=: workspaceId];
  274. if(workspaceObj.size()>0 && Account__c == mappedAccId ){
  275. System.debug('Account is mapped');
  276. mappedAcc = Account__r.Name;
  277. response.put('hasError',false);
  278. response.put('Account__r.Name', mappedAcc);
  279.  
  280. }
  281. else{
  282. system.debug('no account is mapped');
  283. }
  284. }
  285. catch(exception e ){
  286. response.put('hasError', true);
  287. response.put('messgae',e.getMessage());
  288. }
  289. return JOSN.seralizePretty(response);
  290. */
  291. @AuraEnabled
  292. public static String unMappAccount(String ajaxData){
  293. Map<String,Object> response = new Map<String,Object>();
  294.  
  295. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  296. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  297. String mappedAccId = CommonUtils.getDataRequestAsString('accId', requestData);
  298. String accMapped = CommonUtils.getDataRequestAsString('accMapped', requestData);
  299. String colType = CommonUtils.getDataRequestAsString('Type', requestData);
  300. List<Workspace__c> workspaceObj = new List<Workspace__c> ();
  301. List<Workspace__c> workspaceObjBase = new List<Workspace__c> ();
  302. try
  303. {
  304. workspaceObjBase = [SELECT Id,Account__c FROM Workspace__c WHERE id=: workspaceId];
  305. workspaceObj= Utils.filterRecords(workspaceObjBase);
  306. if(workspaceObj.size()>0 ){
  307. for( Workspace__c wrkObj : workspaceObj ){
  308. if( colType == 'delete'){
  309. wrkObj.Account__c = null ;
  310. }
  311. else if (colType == 'edit'){
  312. wrkObj.Account__c = mappedAccId ;
  313.  
  314. }
  315. }
  316. update workspaceObj;
  317. }
  318. }
  319. catch(Exception e)
  320. {
  321. response.put('hasError', true);
  322. response.put('Message', e.getMessage());
  323. return JSON.serializePretty(response);
  324. }
  325.  
  326. response.put('hasError', false);
  327. if(colType == 'delete'){
  328. response.put('Message', 'Account deleted successfully');
  329.  
  330. }
  331. else {
  332. response.put('Message', 'Account updated successfully');
  333.  
  334. }
  335.  
  336.  
  337. return JSON.serializePretty(response);
  338. }
  339. @AuraEnabled
  340. public static String editRoomName(String ajaxData){
  341. Map<String,Object> response = new Map<String,Object>();
  342. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  343. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  344. String roomName = CommonUtils.getDataRequestAsString('roomName', requestData);
  345.  
  346. try{
  347. List<Workspace__c> workspaceObj =[SELECT Id ,Name FROM Workspace__c WHERE Id=: workspaceId];
  348.  
  349. if(workspaceObj.size()> 0 && roomName != null ){
  350. for( Workspace__c wrkObj : workspaceObj){
  351. wrkObj.Name = roomName;
  352. }
  353.  
  354. }
  355. UPDATE workspaceObj ;
  356. response.put('roomName', roomName);
  357. response.put('hasError', false);
  358.  
  359.  
  360. }
  361. catch(exception e ){
  362. response.put('hasError', true);
  363. response.put('message', e.getMessage());
  364. }
  365. return JSON.serializePretty(response);
  366.  
  367.  
  368.  
  369. }
  370. @AuraEnabled
  371. public static String editAccountName(String ajaxData){
  372. Map<String,Object> response = new Map<String,Object>();
  373. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  374. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  375. String accountName = CommonUtils.getDataRequestAsString('accountName', requestData);
  376. try{
  377. List<Workspace__c> workspaceObj =[SELECT Id ,Name,Account__r.Name FROM Workspace__c WHERE Id=: workspaceId];
  378.  
  379. if(workspaceObj.size()> 0 && accountName != null ){
  380. for( Workspace__c wrkObj : workspaceObj){
  381. wrkObj.Account__r.Name = accountName;
  382. }
  383.  
  384. }
  385. UPDATE workspaceObj ;
  386. response.put('accountName', accountName);
  387. response.put('hasError', false);
  388.  
  389.  
  390. }
  391. catch(exception e ){
  392. response.put('hasError', true);
  393. response.put('message', e.getMessage());
  394. }
  395. return JSON.serializePretty(response);
  396.  
  397. }
  398. //@AuraEnabled
  399. /* public static String accountDatatable(String ajaxData)
  400. {
  401. Map<String,Object> response = new Map<String,Object>();
  402. try{
  403. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  404. //List<Workspace__c> workspaceObj = new List<Workspace__c> () ;
  405. //String colType = CommonUtils.getDataRequestAsString('Type', requestData);
  406. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  407. try
  408. {
  409. List<AggregateResult> workspaceObjBase = [ SELECT Contact__r.Account.name, Account_Name__c FROM SR_Member__c where Smart_room__c=: workspaceId and Type__c = 'EXTERNAL' group by Contact__r.Account.name, Account_Name__c];
  410. // workspaceObj= (Workspace__c)Utils.filterRecords(workspaceObjBase);
  411. response.put('workspaceObjBase',workspaceObjBase );
  412. response.put('hasError', false);
  413. response.put('Message', 'Operation successful');
  414. } catch (Exception e1 )
  415. {
  416. response.put('hasError', true);
  417. response.put('Message', e1.getMessage());
  418. }
  419. return JSON.serializePretty(response);
  420.  
  421. }
  422. catch(Exception e2){
  423. response.put('hasError', true);
  424. response.put('Message', e2.getMessage());
  425. }
  426. return JSON.serializePretty(response);
  427.  
  428.  
  429. } */
  430.  
  431. @AuraEnabled
  432. public static String getRedirectURL(String ajaxData){
  433.  
  434. Map<String,Object> requestData = (Map<String,Object>)JSON.deserializeUntyped(ajaxData);
  435. String workspaceId = CommonUtils.getDataRequestAsString('workspaceId', requestData);
  436. string roomUrl = RequestScopeDataUtils.getInstance().getRoomURL();
  437. String roomurls= roomUrl;//.replace('SmartRoom',''); // GT @ SCB-18832
  438. String redirectUrl= roomurls+'/'+Utils.getAppPackageName()+'SmartroomLogin?roomId='+workspaceId+'&email=customer_Email';
  439.  
  440. return redirectURL;
  441.  
  442.  
  443. }
  444. @AuraEnabled
  445. public static Map<String,Object> getAccessURl(String ajaxData)
  446. {
  447. Map<String,Object> response=new Map<String,Object>();
  448. String finalData = SRSmartRoomService.getGuestUserURL(ajaxData);
  449. response = (Map<String,Object>)JSON.deserializeUntyped(finalData);
  450. return response;
  451. }
  452.  
  453.  
  454.  
  455. } //!Final Brace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement