Subversion Repositories SmartDukaan

Rev

Rev 35921 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35921 Rev 35927
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
-
 
3
import java.time.LocalDateTime;
-
 
4
import java.util.ArrayList;
-
 
5
import java.util.List;
-
 
6
 
-
 
7
import javax.mail.internet.InternetAddress;
-
 
8
import javax.mail.internet.MimeMessage;
3
import javax.servlet.http.HttpServletRequest;
9
import javax.servlet.http.HttpServletRequest;
4
 
10
 
5
import com.spice.profitmandi.dao.model.FofoRBMReportingModel;
-
 
6
import com.spice.profitmandi.dao.model.FofoReportingModel;
-
 
7
import org.apache.logging.log4j.LogManager;
11
import org.apache.logging.log4j.LogManager;
8
import org.apache.logging.log4j.Logger;
12
import org.apache.logging.log4j.Logger;
9
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.http.MediaType;
14
import org.springframework.http.MediaType;
11
import org.springframework.http.ResponseEntity;
15
import org.springframework.http.ResponseEntity;
-
 
16
import org.springframework.mail.javamail.JavaMailSender;
-
 
17
import org.springframework.mail.javamail.MimeMessageHelper;
12
import org.springframework.stereotype.Controller;
18
import org.springframework.stereotype.Controller;
13
import org.springframework.transaction.annotation.Transactional;
19
import org.springframework.transaction.annotation.Transactional;
-
 
20
import org.springframework.web.bind.annotation.RequestBody;
14
import org.springframework.web.bind.annotation.RequestMapping;
21
import org.springframework.web.bind.annotation.RequestMapping;
15
import org.springframework.web.bind.annotation.RequestMethod;
22
import org.springframework.web.bind.annotation.RequestMethod;
16
import org.springframework.web.bind.annotation.RequestParam;
23
import org.springframework.web.bind.annotation.RequestParam;
17
 
24
 
18
import com.spice.profitmandi.common.model.ProfitMandiConstants;
25
import com.spice.profitmandi.common.model.ProfitMandiConstants;
-
 
26
import com.spice.profitmandi.common.model.UserInfo;
19
import com.spice.profitmandi.common.web.util.ResponseSender;
27
import com.spice.profitmandi.common.web.util.ResponseSender;
20
import com.spice.profitmandi.dao.entity.auth.AuthUser;
28
import com.spice.profitmandi.dao.entity.auth.AuthUser;
-
 
29
import com.spice.profitmandi.dao.entity.dtr.User;
21
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
30
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
22
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
31
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
-
 
32
import com.spice.profitmandi.dao.repository.cs.CallbackRequestRepository;
23
import com.spice.profitmandi.dao.repository.cs.CsService;
33
import com.spice.profitmandi.dao.repository.cs.CsService;
-
 
34
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
-
 
35
import com.spice.profitmandi.web.req.CallbackRequest;
24
import com.spice.profitmandi.web.res.SupportTeamResponse;
36
import com.spice.profitmandi.web.res.SupportTeamResponse;
25
import com.spice.profitmandi.web.res.SupportTeamResponse.PersonDetail;
37
import com.spice.profitmandi.web.res.SupportTeamResponse.ContactDetail;
26
 
38
 
27
import io.swagger.annotations.ApiImplicitParam;
39
import io.swagger.annotations.ApiImplicitParam;
28
import io.swagger.annotations.ApiImplicitParams;
40
import io.swagger.annotations.ApiImplicitParams;
29
import io.swagger.annotations.ApiOperation;
41
import io.swagger.annotations.ApiOperation;
30
 
42
 
31
import java.util.Map;
-
 
32
 
-
 
33
@Controller
43
@Controller
34
@Transactional(rollbackFor = Throwable.class)
44
@Transactional(rollbackFor = Throwable.class)
35
public class SupportController {
45
public class SupportController {
36
 
46
 
37
    private static final Logger LOGGER = LogManager.getLogger(SupportController.class);
47
    private static final Logger LOGGER = LogManager.getLogger(SupportController.class);
Line 43... Line 53...
43
    private CsService csService;
53
    private CsService csService;
44
 
54
 
45
    @Autowired
55
    @Autowired
46
    private AuthRepository authRepository;
56
    private AuthRepository authRepository;
47
 
57
 
-
 
58
    @Autowired
-
 
59
    private UserRepository userRepository;
-
 
60
 
-
 
61
    @Autowired
-
 
62
    private JavaMailSender mailSender;
-
 
63
 
-
 
64
    @Autowired
-
 
65
    private CallbackRequestRepository callbackRequestRepository;
-
 
66
 
48
    @RequestMapping(value = "/support/team", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
67
    @RequestMapping(value = "/support/team", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
49
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
68
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
50
    @ApiOperation(value = "Get assigned ABM, BM, RBM and RBM Manager for a FOFO store")
69
    @ApiOperation(value = "Get assigned support team for a FOFO store grouped by escalation level")
51
    public ResponseEntity<?> getSupportTeam(HttpServletRequest request, @RequestParam(value = "fofoId") int fofoId) throws Throwable {
70
    public ResponseEntity<?> getSupportTeam(HttpServletRequest request, @RequestParam(value = "fofoId") int fofoId) throws Throwable {
52
        LOGGER.info("Getting support team for fofoId: {}", fofoId);
71
        LOGGER.info("Getting support team for fofoId: {}", fofoId);
53
 
72
 
54
        SupportTeamResponse response = new SupportTeamResponse();
73
        List<SupportTeamResponse> response = new ArrayList<>();
-
 
74
 
-
 
75
        // --- LEVEL 1 - IMMEDIATE SUPPORT ---
-
 
76
        List<ContactDetail> l1Contacts = new ArrayList<>();
-
 
77
 
55
        // ABM = SALES category, L1
78
        // RBM = RBM category, L1
56
        try {
79
        try {
57
            int abmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L1, fofoId);
80
            int rbmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
58
            if (abmAuthUserId > 0) {
81
            if (rbmAuthUserId > 0) {
59
                AuthUser abmUser = authRepository.selectById(abmAuthUserId);
82
                AuthUser user = authRepository.selectById(rbmAuthUserId);
60
                if (abmUser != null) {
83
                if (user != null) {
-
 
84
                    l1Contacts.add(buildContact(user, "RBM", "#1a7a4c",
61
                    response.setAbm(toPersonDetail(abmUser, "Sales support and regional queries"));
85
                            "First point of contact for all queries", true, true, false, true));
62
                }
86
                }
63
            }
87
            }
64
        } catch (Exception e) {
88
        } catch (Exception e) {
65
            LOGGER.warn("Could not fetch ABM for fofoId: {}", fofoId, e);
89
            LOGGER.warn("Could not fetch RBM for fofoId: {}", fofoId, e);
66
        }
90
        }
67
 
91
 
68
        // BM = SALES category, L2
92
        // ABM = SALES category, L1
69
        try {
93
        try {
70
            int bmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2, fofoId);
94
            int abmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L1, fofoId);
71
            if (bmAuthUserId > 0) {
95
            if (abmAuthUserId > 0) {
72
                AuthUser bmUser = authRepository.selectById(bmAuthUserId);
96
                AuthUser user = authRepository.selectById(abmAuthUserId);
73
                if (bmUser != null) {
97
                if (user != null) {
-
 
98
                    l1Contacts.add(buildContact(user, "ASM", "#1a7a4c",
74
                    response.setBm(toPersonDetail(bmUser, "Handles: Orders, Stock, Schemes"));
99
                            "Sales support and regional queries", true, true, false, false));
75
                }
100
                }
76
            }
101
            }
77
        } catch (Exception e) {
102
        } catch (Exception e) {
78
            LOGGER.warn("Could not fetch BM for fofoId: {}", fofoId, e);
103
            LOGGER.warn("Could not fetch ABM for fofoId: {}", fofoId, e);
79
        }
104
        }
80
 
105
 
81
        // RBM = RBM category, L1
-
 
82
        try {
-
 
83
            int rbmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
-
 
84
            if (rbmAuthUserId > 0) {
106
        if (!l1Contacts.isEmpty()) {
85
                AuthUser rbmUser = authRepository.selectById(rbmAuthUserId);
-
 
86
                if (rbmUser != null) {
-
 
87
                    response.setRbm(toPersonDetail(rbmUser, "First point of contact for all queries"));
107
            response.add(new SupportTeamResponse("LEVEL 1 - IMMEDIATE SUPPORT", l1Contacts));
88
                }
-
 
89
            }
-
 
90
        } catch (Exception e) {
-
 
91
            LOGGER.warn("Could not fetch RBM for fofoId: {}", fofoId, e);
-
 
92
        }
108
        }
93
 
109
 
-
 
110
        // --- LEVEL 2 - SPECIALIZED SUPPORT ---
-
 
111
        List<ContactDetail> l2Contacts = new ArrayList<>();
-
 
112
 
94
        // RBM Manager = RBM category, L2
113
        // RBM Manager = RBM category, L2
95
        try {
114
        try {
96
            int rbmManagerAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L2, fofoId);
115
            int rbmManagerAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L2, fofoId);
97
            if (rbmManagerAuthUserId > 0) {
116
            if (rbmManagerAuthUserId > 0) {
98
                AuthUser rbmManagerUser = authRepository.selectById(rbmManagerAuthUserId);
117
                AuthUser user = authRepository.selectById(rbmManagerAuthUserId);
99
                if (rbmManagerUser != null) {
118
                if (user != null) {
100
                    response.setRbmManager(toPersonDetail(rbmManagerUser,"For escalated regional matters\n" +
119
                    l2Contacts.add(buildContact(user, "RBM MANAGER", "#7c3aed",
101
                            "\n"));
120
                            "For escalated regional matters", false, false, true, true));
102
                }
121
                }
103
            }
122
            }
104
        } catch (Exception e) {
123
        } catch (Exception e) {
105
            LOGGER.warn("Could not fetch RBM Manager for fofoId: {}", fofoId, e);
124
            LOGGER.warn("Could not fetch RBM Manager for fofoId: {}", fofoId, e);
106
        }
125
        }
107
 
126
 
108
        // Grievance Manager = CATEGORY_LEGAL category, L3
127
        // BM = SALES category, L2
109
        try {
128
        try {
110
            int grievanceManagerAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_LEGAL, EscalationType.L3, fofoId);
129
            int bmAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2, fofoId);
111
            if (grievanceManagerAuthUserId > 0) {
130
            if (bmAuthUserId > 0) {
112
                AuthUser grievanceManagerUser = authRepository.selectById(grievanceManagerAuthUserId);
131
                AuthUser user = authRepository.selectById(bmAuthUserId);
113
                if (grievanceManagerUser != null) {
132
                if (user != null) {
-
 
133
                    l2Contacts.add(buildContact(user, "BM", "#1e6091",
114
                    response.setGrievanceManager(toPersonDetail(grievanceManagerUser,"For unresolved issues & formal complaints"));
134
                            "Handles: Orders, Stock, Schemes", false, false, true, false));
115
                }
135
                }
116
            }
136
            }
117
        } catch (Exception e) {
137
        } catch (Exception e) {
118
            LOGGER.warn("Could not fetch Grievance Manager for fofoId: {}", fofoId, e);
138
            LOGGER.warn("Could not fetch BM for fofoId: {}", fofoId, e);
119
        }
139
        }
120
 
140
 
121
        // Affordability Manager = TICKET_CATEGORY_FINANCIAL_SERVICES category, L2
141
        // Affordability Operations = FINANCIAL_SERVICES category, L2
122
        try {
142
        try {
123
            int affordabilityManagerAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, EscalationType.L2, fofoId);
143
            int affordAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, EscalationType.L2, fofoId);
124
            if (affordabilityManagerAuthUserId > 0) {
144
            if (affordAuthUserId > 0) {
125
                AuthUser affordabilityManagerUser = authRepository.selectById(affordabilityManagerAuthUserId);
145
                AuthUser user = authRepository.selectById(affordAuthUserId);
126
                if (affordabilityManagerUser != null) {
146
                if (user != null) {
-
 
147
                    l2Contacts.add(buildContact(user, "AFFORDABILITY & OPERATIONS", "#d97706",
127
                    response.setBrandingManager(toPersonDetail(affordabilityManagerUser,"Credit, payment plans, and operations"));
148
                            "Credit, payment plans, and operations", false, false, true, false));
128
                }
149
                }
129
            }
150
            }
130
        } catch (Exception e) {
151
        } catch (Exception e) {
131
            LOGGER.warn("Could not fetch Affordability Manager for fofoId: {}", fofoId, e);
152
            LOGGER.warn("Could not fetch Affordability Manager for fofoId: {}", fofoId, e);
132
        }
153
        }
133
 
154
 
134
        // Branding Manager = CATEGORY_DESIGN category, L1
155
        // Branding Manager = DESIGN category, L1
135
        try {
156
        try {
136
            int brandingManagerAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_DESIGN, EscalationType.L1, fofoId);
157
            int brandingAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_DESIGN, EscalationType.L1, fofoId);
137
            if (brandingManagerAuthUserId > 0) {
158
            if (brandingAuthUserId > 0) {
138
                AuthUser brandingManagerUser = authRepository.selectById(brandingManagerAuthUserId);
159
                AuthUser user = authRepository.selectById(brandingAuthUserId);
139
                if (brandingManagerUser != null) {
160
                if (user != null) {
-
 
161
                    l2Contacts.add(buildContact(user, "BRANDING", "#1a7a4c",
140
                    response.setBrandingManager(toPersonDetail(brandingManagerUser,"Brand guidelines and marketing support"));
162
                            "Brand guidelines and marketing support", false, false, true, false));
141
                }
163
                }
142
            }
164
            }
143
        } catch (Exception e) {
165
        } catch (Exception e) {
144
            LOGGER.warn("Could not fetch Branding Manager for fofoId: {}", fofoId, e);
166
            LOGGER.warn("Could not fetch Branding Manager for fofoId: {}", fofoId, e);
145
        }
167
        }
146
 
168
 
-
 
169
        if (!l2Contacts.isEmpty()) {
-
 
170
            response.add(new SupportTeamResponse("LEVEL 2 - SPECIALIZED SUPPORT", l2Contacts));
-
 
171
        }
-
 
172
 
-
 
173
        // --- LEVEL 3 - ESCALATION ---
-
 
174
        List<ContactDetail> l3Contacts = new ArrayList<>();
-
 
175
 
-
 
176
        // Grievance Manager = LEGAL category, L3
-
 
177
        try {
-
 
178
            int grievanceAuthUserId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_LEGAL, EscalationType.L1, fofoId);
-
 
179
            if (grievanceAuthUserId > 0) {
-
 
180
                AuthUser user = authRepository.selectById(grievanceAuthUserId);
-
 
181
                if (user != null) {
-
 
182
                    l3Contacts.add(buildContact(user, "GRIEVANCE OFFICER", "#dc2626",
-
 
183
                            "For unresolved issues & formal complaints", false, false, true, true));
-
 
184
                }
-
 
185
            }
-
 
186
        } catch (Exception e) {
-
 
187
            LOGGER.warn("Could not fetch Grievance Manager for fofoId: {}", fofoId, e);
-
 
188
        }
-
 
189
 
-
 
190
        if (!l3Contacts.isEmpty()) {
-
 
191
            response.add(new SupportTeamResponse("LEVEL 3 - ESCALATION", l3Contacts));
-
 
192
        }
-
 
193
 
147
        return responseSender.ok(response);
194
        return responseSender.ok(response);
148
    }
195
    }
149
 
196
 
-
 
197
    @RequestMapping(value = "/support/callback-request", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
198
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
-
 
199
    @ApiOperation(value = "Submit a callback request to a support contact")
-
 
200
    public ResponseEntity<?> requestCallback(HttpServletRequest request, @RequestBody CallbackRequest callbackRequest) throws Throwable {
-
 
201
        UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
-
 
202
        User user = userRepository.selectById(userInfo.getUserId());
-
 
203
 
-
 
204
        LOGGER.info("Callback request from userId: {} to contactId: {} subject: {}",
-
 
205
                userInfo.getUserId(), callbackRequest.getContactId(), callbackRequest.getSubject());
-
 
206
 
-
 
207
        // Save to database
-
 
208
        com.spice.profitmandi.dao.entity.cs.CallbackRequest entity = new com.spice.profitmandi.dao.entity.cs.CallbackRequest();
-
 
209
        entity.setFofoId(userInfo.getRetailerId());
-
 
210
        entity.setUserId(userInfo.getUserId());
-
 
211
        entity.setContactId(callbackRequest.getContactId());
-
 
212
        entity.setContactName(callbackRequest.getContactName());
-
 
213
        entity.setContactRole(callbackRequest.getContactRole());
-
 
214
        entity.setSubject(callbackRequest.getSubject());
-
 
215
        entity.setMessage(callbackRequest.getMessage());
-
 
216
        entity.setTiming(callbackRequest.getTiming());
-
 
217
        entity.setStatus("PENDING");
-
 
218
        entity.setCreateTimestamp(LocalDateTime.now());
-
 
219
        entity.setUpdateTimestamp(LocalDateTime.now());
-
 
220
        callbackRequestRepository.persist(entity);
-
 
221
        LOGGER.info("Callback request saved with id: {}", entity.getId());
-
 
222
 
-
 
223
        String timingLabel = "11-15".equals(callbackRequest.getTiming()) ? "11:00 AM - 3:00 PM" : "3:00 PM - 7:00 PM";
-
 
224
 
-
 
225
        // Send email to the support contact
-
 
226
        AuthUser contactUser = authRepository.selectById(callbackRequest.getContactId());
-
 
227
        if (contactUser == null || contactUser.getEmailId() == null) {
-
 
228
            LOGGER.warn("Contact user not found or has no email for contactId: {}", callbackRequest.getContactId());
-
 
229
            return responseSender.ok(true);
-
 
230
        }
-
 
231
 
-
 
232
        MimeMessage message = mailSender.createMimeMessage();
-
 
233
        MimeMessageHelper helper = new MimeMessageHelper(message);
-
 
234
        helper.setSubject("Callback Request: " + callbackRequest.getSubject());
-
 
235
 
-
 
236
        String emailContent = "<html>"
-
 
237
                + "<body style='font-family: Arial, sans-serif; color: #333;'>"
-
 
238
                + "<h2 style='color: #d5282c;'>New Callback Request</h2>"
-
 
239
                + "<table style='border-collapse: collapse; width: 100%; max-width: 500px;'>"
-
 
240
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>From:</td>"
-
 
241
                + "<td style='padding: 8px;'>" + user.getFirstName() + " (" + user.getMobileNumber() + ")</td></tr>"
-
 
242
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>Email:</td>"
-
 
243
                + "<td style='padding: 8px;'>" + user.getEmailId() + "</td></tr>"
-
 
244
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>To:</td>"
-
 
245
                + "<td style='padding: 8px;'>" + callbackRequest.getContactName() + " (" + callbackRequest.getContactRole() + ")</td></tr>"
-
 
246
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>Subject:</td>"
-
 
247
                + "<td style='padding: 8px;'>" + callbackRequest.getSubject() + "</td></tr>"
-
 
248
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>Message:</td>"
-
 
249
                + "<td style='padding: 8px;'>" + callbackRequest.getMessage() + "</td></tr>"
-
 
250
                + "<tr><td style='padding: 8px; font-weight: bold; color: #555;'>Preferred Timing:</td>"
-
 
251
                + "<td style='padding: 8px;'>" + timingLabel + "</td></tr>"
-
 
252
                + "</table>"
-
 
253
                + "<br><p style='color: #999; font-size: 12px;'>This callback request was submitted via the SmartDukaan Support page.</p>"
-
 
254
                + "</body></html>";
-
 
255
 
-
 
256
        helper.setText(emailContent, true);
-
 
257
        InternetAddress senderAddress = new InternetAddress("care@smartdukaan.com", "SmartDukaan Support");
-
 
258
        helper.setFrom(senderAddress);
-
 
259
        helper.setTo(contactUser.getEmailId());
-
 
260
        helper.setReplyTo(user.getEmailId());
-
 
261
 
-
 
262
        mailSender.send(message);
-
 
263
        LOGGER.info("Callback request email sent to: {}", contactUser.getEmailId());
-
 
264
 
-
 
265
        return responseSender.ok(true);
-
 
266
    }
-
 
267
 
150
    private PersonDetail toPersonDetail(AuthUser authUser, String description) {
268
    private ContactDetail buildContact(AuthUser authUser, String badge, String badgeColor,
-
 
269
                                       String description, boolean showCall, boolean showMessage,
-
 
270
                                       boolean showCallback, boolean expanded) {
151
        return new PersonDetail(
271
        ContactDetail contact = new ContactDetail();
152
                authUser.getId(),
272
        contact.setId(authUser.getId());
153
                authUser.getFullName(),
273
        contact.setName(authUser.getFullName());
-
 
274
        contact.setInitials(getInitials(authUser.getFirstName(), authUser.getLastName()));
-
 
275
        contact.setRole(badge);
-
 
276
        contact.setBadge(badge);
-
 
277
        contact.setBadgeColor(badgeColor);
-
 
278
        contact.setDescription(description);
-
 
279
        contact.setPhone("tel:+91" + authUser.getMobileNumber());
-
 
280
        contact.setWhatsapp("https://wa.me/91" + authUser.getMobileNumber());
154
                authUser.getEmailId(),
281
        contact.setEmail(authUser.getEmailId());
-
 
282
        contact.setShowCall(showCall);
155
                authUser.getMobileNumber(),
283
        contact.setShowMessage(showMessage);
-
 
284
        contact.setShowCallback(showCallback);
-
 
285
        contact.setExpanded(expanded);
156
                description
286
        return contact;
-
 
287
    }
-
 
288
 
-
 
289
    private String getInitials(String firstName, String lastName) {
-
 
290
        StringBuilder initials = new StringBuilder();
-
 
291
        if (firstName != null && !firstName.isEmpty()) {
-
 
292
            initials.append(firstName.charAt(0));
-
 
293
        }
-
 
294
        if (lastName != null && !lastName.isEmpty()) {
-
 
295
            initials.append(lastName.charAt(0));
157
        );
296
        }
-
 
297
        return initials.toString().toUpperCase();
158
    }
298
    }
159
}
299
}