fork download
  1. @model IEnumerable<EMPDETAILS.Models.EmployeeDetails>
  2.  
  3. @{
  4. ViewBag.Title = "Employee Records";
  5. }
  6.  
  7. <h4 class="text-center mb-4">Employee Records</h4>
  8.  
  9. <!-- DataTable HTML -->
  10. <table id="employeeTable" class="table table-bordered table-striped">
  11. <thead class="thead-dark">
  12. <tr>
  13. <th>Full Name</th>
  14. <th>Date of Birth</th>
  15. <th>Gender</th>
  16. <th>Phone Number</th>
  17. <th>Address</th>
  18. <th>District</th>
  19. <th>PinCode</th>
  20. <th>Email ID</th>
  21. <th>Marital Status</th>
  22. <th>Blood Group</th>
  23. <th>Pan Card No</th>
  24. <th>Aadhar Card No</th>
  25. <th>Company Name</th>
  26. <th>Department</th>
  27. <th>PF Number</th>
  28. <th>UAN Number</th>
  29. <th>HR Name</th>
  30. <th>HR Contact Number</th>
  31. <th>HR Email ID</th>
  32. <th>Reporting Manager Name</th>
  33. <th>Reporting Manager Contact No</th>
  34. <th>Reporting Manager Email ID</th>
  35. <th>Reference Name</th>
  36. <th>Reference Phone No</th>
  37. <th>Reference Email ID</th>
  38. <th>Family Name</th>
  39. <th>Family Relation</th>
  40. <th>Family DOB</th>
  41. <th>Nominee Name</th>
  42. <th>Nominee Relation</th>
  43. <th>Nominee DOB</th>
  44. <th>Nominee Contact No</th>
  45. <th>Emergency Contact Name</th>
  46. <th>Emergency Contact Relation</th>
  47. <th>Emergency Contact Phone No</th>
  48. <th>Document Pan File</th>
  49. <th>Document Aadhar File</th>
  50. <th>Document License File</th>
  51. <th>Document Passport File</th>
  52. <th>Document Bank Details File</th>
  53. <th>Educational Certificate File</th>
  54. <th>Relieving Letter File</th>
  55. <th>Position</th>
  56. <th>Joining Date</th>
  57. <th>Location</th>
  58. <th>Manager</th>
  59. <th>Actions</th> <!-- New column for the View Details Button -->
  60. </tr>
  61. </thead>
  62. <tbody>
  63. @foreach (var employee in Model)
  64. {
  65. <tr>
  66. <td>@employee.FullName</td>
  67. <td>@Convert.ToDateTime(employee.DateOfBirth).ToString("dd-MM-yyyy")</td>
  68. <td>@employee.Gender</td>
  69. <td>@employee.PhoneNumber</td>
  70. <td>@employee.Address</td>
  71. <td>@employee.District</td>
  72. <td>@employee.PinCode</td>
  73. <td>@employee.EmailId</td>
  74. <td>@employee.MaritalStatus</td>
  75. <td>@employee.BloodGroup</td>
  76. <td>@employee.PanCardNo</td>
  77. <td>@employee.AadharCardNo</td>
  78. <td>@employee.CompanyName</td>
  79. <td>@employee.Department</td>
  80. <td>@employee.PFNumber</td>
  81. <td>@employee.UANNumber</td>
  82. <td>@employee.HRName</td>
  83. <td>@employee.HRContactNumber</td>
  84. <td>@employee.HREmailId</td>
  85. <td>@employee.ReportingManagerName</td>
  86. <td>@employee.ReportingManagerContactNo</td>
  87. <td>@employee.ReportingManagerEmailId</td>
  88. <td>@employee.ReferenceName</td>
  89. <td>@employee.ReferencePhoneNo</td>
  90. <td>@employee.ReferenceEmailId</td>
  91. <td>@employee.FamilyName</td>
  92. <td>@employee.FamilyRelation</td>
  93. <td>@Convert.ToDateTime(employee.FamilyDOB).ToString("dd-MM-yyyy")</td>
  94. <td>@employee.NomineeName</td>
  95. <td>@employee.NomineeRelation</td>
  96. <td>@Convert.ToDateTime(employee.NomineeDOB).ToString("dd-MM-yyyy")</td>
  97. <td>@employee.NomineeContactNo</td>
  98. <td>@employee.EmergencyContactName</td>
  99. <td>@employee.EmergencyContactRelation</td>
  100. <td>@employee.EmergencyContactPhoneNo</td>
  101. <td>
  102. @(string.IsNullOrEmpty(employee.DocumentPanFilePath) ? "" :
  103. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentPanFilePath) }) + "' download>Download</a>")
  104. </td>
  105. <td>
  106. @(string.IsNullOrEmpty(employee.DocumentAadharFilePath) ? "" :
  107. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentAadharFilePath) }) + "' download>Download</a>")
  108. </td>
  109. <td>
  110. @(string.IsNullOrEmpty(employee.DocumentLicenseFilePath) ? "" :
  111. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentLicenseFilePath) }) + "' download>Download</a>")
  112. </td>
  113. <td>
  114. @(string.IsNullOrEmpty(employee.DocumentPassportFilePath) ? "" :
  115. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentPassportFilePath) }) + "' download>Download</a>")
  116. </td>
  117. <td>
  118. @(string.IsNullOrEmpty(employee.DocumentBankDetailsFilePath) ? "" :
  119. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentBankDetailsFilePath) }) + "' download>Download</a>")
  120. </td>
  121. <td>
  122. @(string.IsNullOrEmpty(employee.EducationalCertificateFilePath) ? "" :
  123. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.EducationalCertificateFilePath) }) + "' download>Download</a>")
  124. </td>
  125. <td>
  126. @(string.IsNullOrEmpty(employee.RelievingLetterFilePath) ? "" :
  127. "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.RelievingLetterFilePath) }) + "' download>Download</a>")
  128. </td>
  129. <td>@employee.Position</td>
  130. <td>@Convert.ToDateTime(employee.JoiningDate).ToString("dd-MM-yyyy")</td>
  131. <td>@employee.Location</td>
  132. <td>@employee.Manager</td>
  133. <td>
  134. <!-- View Details Button -->
  135. <button class="btn btn-info btn-sm"
  136. data-toggle="modal"
  137. data-target="#employeeModal"
  138. data-id="@employee.EMPId"
  139. data-fullname="@employee.FullName"
  140. data-dob="@Convert.ToDateTime(employee.DateOfBirth).ToString("dd-MM-yyyy")"
  141. data-gender="@employee.Gender"
  142. data-phone="@employee.PhoneNumber"
  143. data-address="@employee.Address"
  144. data-district="@employee.District"
  145. data-pincode="@employee.PinCode"
  146. data-email="@employee.EmailId"
  147. data-maritalstatus="@employee.MaritalStatus"
  148. data-bloodgroup="@employee.BloodGroup"
  149. data-pancard="@employee.PanCardNo"
  150. data-aadharcard="@employee.AadharCardNo"
  151. data-companyname="@employee.CompanyName"
  152. data-department="@employee.Department"
  153. data-pfnumber="@employee.PFNumber"
  154. data-uannumber="@employee.UANNumber"
  155. data-hrname="@employee.HRName"
  156. data-hrcontact="@employee.HRContactNumber"
  157. data-hremail="@employee.HREmailId"
  158. data-reportingmanager="@employee.ReportingManagerName"
  159. data-reportingcontact="@employee.ReportingManagerContactNo"
  160. data-reportingemail="@employee.ReportingManagerEmailId"
  161. data-referencename="@employee.ReferenceName"
  162. data-referencephone="@employee.ReferencePhoneNo"
  163. data-referenceemail="@employee.ReferenceEmailId"
  164. data-familyname="@employee.FamilyName"
  165. data-familyrelation="@employee.FamilyRelation"
  166. data-familydob="@Convert.ToDateTime(employee.FamilyDOB).ToString("dd-MM-yyyy")"
  167. data-nomineename="@employee.NomineeName"
  168. data-nomineerelation="@employee.NomineeRelation"
  169. data-nomineedob="@Convert.ToDateTime(employee.NomineeDOB).ToString("dd-MM-yyyy")"
  170. data-nomineecontact="@employee.NomineeContactNo"
  171. data-emergencycontact="@employee.EmergencyContactName"
  172. data-emergencyrelation="@employee.EmergencyContactRelation"
  173. data-emergencyphone="@employee.EmergencyContactPhoneNo"
  174. data-position="@employee.Position"
  175. data-joiningdate="@Convert.ToDateTime(employee.JoiningDate).ToString("dd-MM-yyyy")"
  176. data-location="@employee.Location"
  177. data-manager="@employee.Manager">
  178. View Details
  179. </button>
  180. </td>
  181. </tr>
  182. }
  183. </tbody>
  184. </table>
  185.  
  186. <!-- Bootstrap Modal for displaying employee details -->
  187. <div class="modal fade" id="employeeModal" tabindex="-1" role="dialog" aria-labelledby="employeeModalLabel" aria-hidden="true">
  188. <div class="modal-dialog modal-lg" role="document">
  189. <div class="modal-content">
  190. <div class="modal-header bg-primary text-white">
  191. <h5 class="modal-title" id="employeeModalLabel">Employee Details</h5>
  192. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  193. <span aria-hidden="true">&times;</span>
  194. </button>
  195. </div>
  196. <div class="modal-body">
  197. <!-- Employee Details Will Be Dynamically Loaded Here -->
  198. <div id="employeeDetailsContent">
  199. <p><strong>Full Name:</strong> <span id="empFullName"></span></p>
  200. <p><strong>Date of Birth:</strong> <span id="empDOB"></span></p>
  201. <p><strong>Gender:</strong> <span id="empGender"></span></p>
  202. <p><strong>Phone Number:</strong> <span id="empPhone"></span></p>
  203. <p><strong>Address:</strong> <span id="empAddress"></span></p>
  204. <p><strong>District:</strong> <span id="empDistrict"></span></p>
  205. <p><strong>PinCode:</strong> <span id="empPinCode"></span></p>
  206. <p><strong>Email ID:</strong> <span id="empEmail"></span></p>
  207. <p><strong>Marital Status:</strong> <span id="empMaritalStatus"></span></p>
  208. <p><strong>Blood Group:</strong> <span id="empBloodGroup"></span></p>
  209. <p><strong>Pan Card No:</strong> <span id="empPanCard"></span></p>
  210. <p><strong>Aadhar Card No:</strong> <span id="empAadharCard"></span></p>
  211. <p><strong>Company Name:</strong> <span id="empCompanyName"></span></p>
  212. <p><strong>Department:</strong> <span id="empDepartment"></span></p>
  213. <p><strong>PF Number:</strong> <span id="empPFNumber"></span></p>
  214. <p><strong>UAN Number:</strong> <span id="empUANNumber"></span></p>
  215. <p><strong>HR Name:</strong> <span id="empHRName"></span></p>
  216. <p><strong>HR Contact Number:</strong> <span id="empHRContact"></span></p>
  217. <p><strong>HR Email ID:</strong> <span id="empHREmail"></span></p>
  218. <p><strong>Reporting Manager Name:</strong> <span id="empReportingManager"></span></p>
  219. <p><strong>Reporting Manager Contact:</strong> <span id="empReportingContact"></span></p>
  220. <p><strong>Reporting Manager Email:</strong> <span id="empReportingEmail"></span></p>
  221. <p><strong>Reference Name:</strong> <span id="empReferenceName"></span></p>
  222. <p><strong>Reference Phone No:</strong> <span id="empReferencePhone"></span></p>
  223. <p><strong>Reference Email ID:</strong> <span id="empReferenceEmail"></span></p>
  224. <p><strong>Family Name:</strong> <span id="empFamilyName"></span></p>
  225. <p><strong>Family Relation:</strong> <span id="empFamilyRelation"></span></p>
  226. <p><strong>Family DOB:</strong> <span id="empFamilyDOB"></span></p>
  227. <p><strong>Nominee Name:</strong> <span id="empNomineeName"></span></p>
  228. <p><strong>Nominee Relation:</strong> <span id="empNomineeRelation"></span></p>
  229. <p><strong>Nominee DOB:</strong> <span id="empNomineeDOB"></span></p>
  230. <p><strong>Nominee Contact No:</strong> <span id="empNomineeContact"></span></p>
  231. <p><strong>Emergency Contact Name:</strong> <span id="empEmergencyContact"></span></p>
  232. <p><strong>Emergency Contact Relation:</strong> <span id="empEmergencyRelation"></span></p>
  233. <p><strong>Emergency Contact Phone No:</strong> <span id="empEmergencyPhone"></span></p>
  234. <p><strong>Position:</strong> <span id="empPosition"></span></p>
  235. <p><strong>Joining Date:</strong> <span id="empJoiningDate"></span></p>
  236. <p><strong>Location:</strong> <span id="empLocation"></span></p>
  237. </div>
  238. </div>
  239. <div class="modal-footer">
  240. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  241. <button type="button" class="btn btn-success" id="printButton">Print</button>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246.  
  247. @section scripts {
  248. <script>
  249. $(document).ready(function () {
  250. // Initialize DataTable with responsive design and export buttons
  251. $('#employeeTable').DataTable({
  252. "scrollX": true,
  253. "pageLength": 10,
  254. "lengthMenu": [10, 25, 50, 100],
  255. "columnDefs": [
  256. { "targets": [46], "orderable": false, "className": "dt-center" }
  257. ],
  258. "dom": 'Bfrtip',
  259. "buttons": ['copy', 'csv', 'excel', 'pdf', 'print'],
  260. "responsive": true,
  261. "ordering": true,
  262. });
  263.  
  264. // When the "View Details" button is clicked, populate the modal with employee details
  265. $('#employeeModal').on('show.bs.modal', function (event) {
  266. var button = $(event.relatedTarget); // Button that triggered the modal
  267. // Fetch employee data from the button attributes and set it to modal
  268. $('#empFullName').text(button.data('fullname'));
  269. $('#empDOB').text(button.data('dob'));
  270. $('#empGender').text(button.data('gender'));
  271. $('#empPhone').text(button.data('phone'));
  272. $('#empAddress').text(button.data('address'));
  273. $('#empDistrict').text(button.data('district'));
  274. $('#empPinCode').text(button.data('pincode'));
  275. $('#empEmail').text(button.data('email'));
  276. $('#empMaritalStatus').text(button.data('maritalstatus'));
  277. $('#empBloodGroup').text(button.data('bloodgroup'));
  278. $('#empPanCard').text(button.data('pancard'));
  279. $('#empAadharCard').text(button.data('aadharcard'));
  280. $('#empCompanyName').text(button.data('companyname'));
  281. $('#empDepartment').text(button.data('department'));
  282. $('#empPFNumber').text(button.data('pfnumber'));
  283. $('#empUANNumber').text(button.data('uannumber'));
  284. $('#empHRName').text(button.data('hrname'));
  285. $('#empHRContact').text(button.data('hrcontact'));
  286. $('#empHREmail').text(button.data('hremail'));
  287. $('#empReportingManager').text(button.data('reportingmanager'));
  288. $('#empReportingContact').text(button.data('reportingcontact'));
  289. $('#empReportingEmail').text(button.data('reportingemail'));
  290. $('#empReferenceName').text(button.data('referencename'));
  291. $('#empReferencePhone').text(button.data('referencephone'));
  292. $('#empReferenceEmail').text(button.data('referenceemail'));
  293. $('#empFamilyName').text(button.data('familyname'));
  294. $('#empFamilyRelation').text(button.data('familyrelation'));
  295. $('#empFamilyDOB').text(button.data('familydob'));
  296. $('#empNomineeName').text(button.data('nomineename'));
  297. $('#empNomineeRelation').text(button.data('nomineerelation'));
  298. $('#empNomineeDOB').text(button.data('nomineedob'));
  299. $('#empNomineeContact').text(button.data('nomineecontact'));
  300. $('#empEmergencyContact').text(button.data('emergencycontact'));
  301. $('#empEmergencyRelation').text(button.data('emergencyrelation'));
  302. $('#empEmergencyPhone').text(button.data('emergencyphone'));
  303. $('#empPosition').text(button.data('position'));
  304. $('#empJoiningDate').text(button.data('joiningdate'));
  305. $('#empLocation').text(button.data('location'));
  306. });
  307.  
  308. // Print button functionality inside modal
  309. $('#printButton').click(function () {
  310. var printContent = document.getElementById("employeeDetailsContent").innerHTML;
  311. var printWindow = window.open('', '', 'height=600,width=800');
  312. printWindow.document.write('<html><head><title>Employee Details</title></head><body>');
  313. printWindow.document.write(printContent);
  314. printWindow.document.write('</body></html>');
  315. printWindow.document.close();
  316. printWindow.print();
  317. });
  318. });
  319. </script>
  320. }
  321.  
Success #stdin #stdout 0.03s 25572KB
stdin
Standard input is empty
stdout
@model IEnumerable<EMPDETAILS.Models.EmployeeDetails>

@{
    ViewBag.Title = "Employee Records";
}

<h4 class="text-center mb-4">Employee Records</h4>

<!-- DataTable HTML -->
<table id="employeeTable" class="table table-bordered table-striped">
    <thead class="thead-dark">
        <tr>
            <th>Full Name</th>
            <th>Date of Birth</th>
            <th>Gender</th>
            <th>Phone Number</th>
            <th>Address</th>
            <th>District</th>
            <th>PinCode</th>
            <th>Email ID</th>
            <th>Marital Status</th>
            <th>Blood Group</th>
            <th>Pan Card No</th>
            <th>Aadhar Card No</th>
            <th>Company Name</th>
            <th>Department</th>
            <th>PF Number</th>
            <th>UAN Number</th>
            <th>HR Name</th>
            <th>HR Contact Number</th>
            <th>HR Email ID</th>
            <th>Reporting Manager Name</th>
            <th>Reporting Manager Contact No</th>
            <th>Reporting Manager Email ID</th>
            <th>Reference Name</th>
            <th>Reference Phone No</th>
            <th>Reference Email ID</th>
            <th>Family Name</th>
            <th>Family Relation</th>
            <th>Family DOB</th>
            <th>Nominee Name</th>
            <th>Nominee Relation</th>
            <th>Nominee DOB</th>
            <th>Nominee Contact No</th>
            <th>Emergency Contact Name</th>
            <th>Emergency Contact Relation</th>
            <th>Emergency Contact Phone No</th>
            <th>Document Pan File</th>
            <th>Document Aadhar File</th>
            <th>Document License File</th>
            <th>Document Passport File</th>
            <th>Document Bank Details File</th>
            <th>Educational Certificate File</th>
            <th>Relieving Letter File</th>
            <th>Position</th>
            <th>Joining Date</th>
            <th>Location</th>
            <th>Manager</th>
            <th>Actions</th> <!-- New column for the View Details Button -->
        </tr>
    </thead>
    <tbody>
        @foreach (var employee in Model)
        {
            <tr>
                <td>@employee.FullName</td>
                <td>@Convert.ToDateTime(employee.DateOfBirth).ToString("dd-MM-yyyy")</td>
                <td>@employee.Gender</td>
                <td>@employee.PhoneNumber</td>
                <td>@employee.Address</td>
                <td>@employee.District</td>
                <td>@employee.PinCode</td>
                <td>@employee.EmailId</td>
                <td>@employee.MaritalStatus</td>
                <td>@employee.BloodGroup</td>
                <td>@employee.PanCardNo</td>
                <td>@employee.AadharCardNo</td>
                <td>@employee.CompanyName</td>
                <td>@employee.Department</td>
                <td>@employee.PFNumber</td>
                <td>@employee.UANNumber</td>
                <td>@employee.HRName</td>
                <td>@employee.HRContactNumber</td>
                <td>@employee.HREmailId</td>
                <td>@employee.ReportingManagerName</td>
                <td>@employee.ReportingManagerContactNo</td>
                <td>@employee.ReportingManagerEmailId</td>
                <td>@employee.ReferenceName</td>
                <td>@employee.ReferencePhoneNo</td>
                <td>@employee.ReferenceEmailId</td>
                <td>@employee.FamilyName</td>
                <td>@employee.FamilyRelation</td>
                <td>@Convert.ToDateTime(employee.FamilyDOB).ToString("dd-MM-yyyy")</td>
                <td>@employee.NomineeName</td>
                <td>@employee.NomineeRelation</td>
                <td>@Convert.ToDateTime(employee.NomineeDOB).ToString("dd-MM-yyyy")</td>
                <td>@employee.NomineeContactNo</td>
                <td>@employee.EmergencyContactName</td>
                <td>@employee.EmergencyContactRelation</td>
                <td>@employee.EmergencyContactPhoneNo</td>
                <td>
                    @(string.IsNullOrEmpty(employee.DocumentPanFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentPanFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.DocumentAadharFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentAadharFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.DocumentLicenseFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentLicenseFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.DocumentPassportFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentPassportFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.DocumentBankDetailsFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.DocumentBankDetailsFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.EducationalCertificateFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.EducationalCertificateFilePath) }) + "' download>Download</a>")
                </td>
                <td>
                    @(string.IsNullOrEmpty(employee.RelievingLetterFilePath) ? "" :
                    "<a href='" + Url.Action("DownloadFile", new { fileName = Path.GetFileName(employee.RelievingLetterFilePath) }) + "' download>Download</a>")
                </td>
                <td>@employee.Position</td>
                <td>@Convert.ToDateTime(employee.JoiningDate).ToString("dd-MM-yyyy")</td>
                <td>@employee.Location</td>
                <td>@employee.Manager</td>
                <td>
                    <!-- View Details Button -->
                    <button class="btn btn-info btn-sm"
                            data-toggle="modal"
                            data-target="#employeeModal"
                            data-id="@employee.EMPId"
                            data-fullname="@employee.FullName"
                            data-dob="@Convert.ToDateTime(employee.DateOfBirth).ToString("dd-MM-yyyy")"
                            data-gender="@employee.Gender"
                            data-phone="@employee.PhoneNumber"
                            data-address="@employee.Address"
                            data-district="@employee.District"
                            data-pincode="@employee.PinCode"
                            data-email="@employee.EmailId"
                            data-maritalstatus="@employee.MaritalStatus"
                            data-bloodgroup="@employee.BloodGroup"
                            data-pancard="@employee.PanCardNo"
                            data-aadharcard="@employee.AadharCardNo"
                            data-companyname="@employee.CompanyName"
                            data-department="@employee.Department"
                            data-pfnumber="@employee.PFNumber"
                            data-uannumber="@employee.UANNumber"
                            data-hrname="@employee.HRName"
                            data-hrcontact="@employee.HRContactNumber"
                            data-hremail="@employee.HREmailId"
                            data-reportingmanager="@employee.ReportingManagerName"
                            data-reportingcontact="@employee.ReportingManagerContactNo"
                            data-reportingemail="@employee.ReportingManagerEmailId"
                            data-referencename="@employee.ReferenceName"
                            data-referencephone="@employee.ReferencePhoneNo"
                            data-referenceemail="@employee.ReferenceEmailId"
                            data-familyname="@employee.FamilyName"
                            data-familyrelation="@employee.FamilyRelation"
                            data-familydob="@Convert.ToDateTime(employee.FamilyDOB).ToString("dd-MM-yyyy")"
                            data-nomineename="@employee.NomineeName"
                            data-nomineerelation="@employee.NomineeRelation"
                            data-nomineedob="@Convert.ToDateTime(employee.NomineeDOB).ToString("dd-MM-yyyy")"
                            data-nomineecontact="@employee.NomineeContactNo"
                            data-emergencycontact="@employee.EmergencyContactName"
                            data-emergencyrelation="@employee.EmergencyContactRelation"
                            data-emergencyphone="@employee.EmergencyContactPhoneNo"
                            data-position="@employee.Position"
                            data-joiningdate="@Convert.ToDateTime(employee.JoiningDate).ToString("dd-MM-yyyy")"
                            data-location="@employee.Location"
                            data-manager="@employee.Manager">
                        View Details
                    </button>
                </td>
            </tr>
        }
    </tbody>
</table>

<!-- Bootstrap Modal for displaying employee details -->
<div class="modal fade" id="employeeModal" tabindex="-1" role="dialog" aria-labelledby="employeeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header bg-primary text-white">
                <h5 class="modal-title" id="employeeModalLabel">Employee Details</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <!-- Employee Details Will Be Dynamically Loaded Here -->
                <div id="employeeDetailsContent">
                    <p><strong>Full Name:</strong> <span id="empFullName"></span></p>
                    <p><strong>Date of Birth:</strong> <span id="empDOB"></span></p>
                    <p><strong>Gender:</strong> <span id="empGender"></span></p>
                    <p><strong>Phone Number:</strong> <span id="empPhone"></span></p>
                    <p><strong>Address:</strong> <span id="empAddress"></span></p>
                    <p><strong>District:</strong> <span id="empDistrict"></span></p>
                    <p><strong>PinCode:</strong> <span id="empPinCode"></span></p>
                    <p><strong>Email ID:</strong> <span id="empEmail"></span></p>
                    <p><strong>Marital Status:</strong> <span id="empMaritalStatus"></span></p>
                    <p><strong>Blood Group:</strong> <span id="empBloodGroup"></span></p>
                    <p><strong>Pan Card No:</strong> <span id="empPanCard"></span></p>
                    <p><strong>Aadhar Card No:</strong> <span id="empAadharCard"></span></p>
                    <p><strong>Company Name:</strong> <span id="empCompanyName"></span></p>
                    <p><strong>Department:</strong> <span id="empDepartment"></span></p>
                    <p><strong>PF Number:</strong> <span id="empPFNumber"></span></p>
                    <p><strong>UAN Number:</strong> <span id="empUANNumber"></span></p>
                    <p><strong>HR Name:</strong> <span id="empHRName"></span></p>
                    <p><strong>HR Contact Number:</strong> <span id="empHRContact"></span></p>
                    <p><strong>HR Email ID:</strong> <span id="empHREmail"></span></p>
                    <p><strong>Reporting Manager Name:</strong> <span id="empReportingManager"></span></p>
                    <p><strong>Reporting Manager Contact:</strong> <span id="empReportingContact"></span></p>
                    <p><strong>Reporting Manager Email:</strong> <span id="empReportingEmail"></span></p>
                    <p><strong>Reference Name:</strong> <span id="empReferenceName"></span></p>
                    <p><strong>Reference Phone No:</strong> <span id="empReferencePhone"></span></p>
                    <p><strong>Reference Email ID:</strong> <span id="empReferenceEmail"></span></p>
                    <p><strong>Family Name:</strong> <span id="empFamilyName"></span></p>
                    <p><strong>Family Relation:</strong> <span id="empFamilyRelation"></span></p>
                    <p><strong>Family DOB:</strong> <span id="empFamilyDOB"></span></p>
                    <p><strong>Nominee Name:</strong> <span id="empNomineeName"></span></p>
                    <p><strong>Nominee Relation:</strong> <span id="empNomineeRelation"></span></p>
                    <p><strong>Nominee DOB:</strong> <span id="empNomineeDOB"></span></p>
                    <p><strong>Nominee Contact No:</strong> <span id="empNomineeContact"></span></p>
                    <p><strong>Emergency Contact Name:</strong> <span id="empEmergencyContact"></span></p>
                    <p><strong>Emergency Contact Relation:</strong> <span id="empEmergencyRelation"></span></p>
                    <p><strong>Emergency Contact Phone No:</strong> <span id="empEmergencyPhone"></span></p>
                    <p><strong>Position:</strong> <span id="empPosition"></span></p>
                    <p><strong>Joining Date:</strong> <span id="empJoiningDate"></span></p>
                    <p><strong>Location:</strong> <span id="empLocation"></span></p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-success" id="printButton">Print</button>
            </div>
        </div>
    </div>
</div>

@section scripts {
    <script>
        $(document).ready(function () {
            // Initialize DataTable with responsive design and export buttons
            $('#employeeTable').DataTable({
                "scrollX": true,
                "pageLength": 10,
                "lengthMenu": [10, 25, 50, 100],
                "columnDefs": [
                    { "targets": [46], "orderable": false, "className": "dt-center" }
                ],
                "dom": 'Bfrtip',
                "buttons": ['copy', 'csv', 'excel', 'pdf', 'print'],
                "responsive": true,
                "ordering": true,
            });

            // When the "View Details" button is clicked, populate the modal with employee details
            $('#employeeModal').on('show.bs.modal', function (event) {
                var button = $(event.relatedTarget); // Button that triggered the modal
                // Fetch employee data from the button attributes and set it to modal
                $('#empFullName').text(button.data('fullname'));
                $('#empDOB').text(button.data('dob'));
                $('#empGender').text(button.data('gender'));
                $('#empPhone').text(button.data('phone'));
                $('#empAddress').text(button.data('address'));
                $('#empDistrict').text(button.data('district'));
                $('#empPinCode').text(button.data('pincode'));
                $('#empEmail').text(button.data('email'));
                $('#empMaritalStatus').text(button.data('maritalstatus'));
                $('#empBloodGroup').text(button.data('bloodgroup'));
                $('#empPanCard').text(button.data('pancard'));
                $('#empAadharCard').text(button.data('aadharcard'));
                $('#empCompanyName').text(button.data('companyname'));
                $('#empDepartment').text(button.data('department'));
                $('#empPFNumber').text(button.data('pfnumber'));
                $('#empUANNumber').text(button.data('uannumber'));
                $('#empHRName').text(button.data('hrname'));
                $('#empHRContact').text(button.data('hrcontact'));
                $('#empHREmail').text(button.data('hremail'));
                $('#empReportingManager').text(button.data('reportingmanager'));
                $('#empReportingContact').text(button.data('reportingcontact'));
                $('#empReportingEmail').text(button.data('reportingemail'));
                $('#empReferenceName').text(button.data('referencename'));
                $('#empReferencePhone').text(button.data('referencephone'));
                $('#empReferenceEmail').text(button.data('referenceemail'));
                $('#empFamilyName').text(button.data('familyname'));
                $('#empFamilyRelation').text(button.data('familyrelation'));
                $('#empFamilyDOB').text(button.data('familydob'));
                $('#empNomineeName').text(button.data('nomineename'));
                $('#empNomineeRelation').text(button.data('nomineerelation'));
                $('#empNomineeDOB').text(button.data('nomineedob'));
                $('#empNomineeContact').text(button.data('nomineecontact'));
                $('#empEmergencyContact').text(button.data('emergencycontact'));
                $('#empEmergencyRelation').text(button.data('emergencyrelation'));
                $('#empEmergencyPhone').text(button.data('emergencyphone'));
                $('#empPosition').text(button.data('position'));
                $('#empJoiningDate').text(button.data('joiningdate'));
                $('#empLocation').text(button.data('location'));
            });

            // Print button functionality inside modal
            $('#printButton').click(function () {
                var printContent = document.getElementById("employeeDetailsContent").innerHTML;
                var printWindow = window.open('', '', 'height=600,width=800');
                printWindow.document.write('<html><head><title>Employee Details</title></head><body>');
                printWindow.document.write(printContent);
                printWindow.document.write('</body></html>');
                printWindow.document.close();
                printWindow.print();
            });
        });
    </script>
}