fork download
  1. <p-toast></p-toast>
  2. <div class="container">
  3. <!-- <div *ngIf="mode === 'list'"> -->
  4. <div *ngIf="mode === 'list'">
  5. <p-button
  6. [rounded]="true"
  7. icon="pi pi-arrow-right"
  8. class="btn btn-danger"
  9. (click)="backToMail()"
  10. label="Test To Mailing List"
  11. />
  12.  
  13. <div class="text-center mb-3">
  14. <h3>Group Mailing List</h3>
  15. </div>
  16. <div class="card shadow">
  17. <div class="card-body">
  18. <div class="grid-container mb-4 mt-2">
  19. <span class="p-float-label input-group">
  20. <input
  21. type="text"
  22. pInputText
  23. id="groupName"
  24. [(ngModel)]="searchFilters.groupName"
  25. />
  26. <label class="font-normal">Group Name</label>
  27. </span>
  28. <!-- Button Search Group Name -->
  29. <p-button
  30. label="Search"
  31. icon="pi pi-search"
  32. [raised]="true"
  33. severity="help"
  34. (click)="searchGroups()"
  35. />
  36. <span></span>
  37. </div>
  38.  
  39. <!--Button ADD Group -->
  40.  
  41. <div class="text-end mb-4 mt-3">
  42. <p-button
  43. class="btn btn-light"
  44. (click)="addGroup()"
  45. icon="pi pi-plus"
  46. label="Add group"
  47. severity="success"
  48. />
  49. </div>
  50.  
  51. <!--Table of Group Name -->
  52. <p-table
  53. [value]="filteredGroupList"
  54. [paginator]="true"
  55. [rows]="10"
  56. [rowsPerPageOptions]="[5, 10, 20]"
  57. [showCurrentPageReport]="true"
  58. currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
  59. >
  60. <!-- Header Table -->
  61. <ng-template pTemplate="header">
  62. <tr>
  63. <th>No.</th>
  64. <th>Detail</th>
  65. <th>Action</th>
  66. <th>Group Name</th>
  67. <th>Create Date</th>
  68. <th>Create By</th>
  69. <th>Modified By</th>
  70. </tr>
  71. </ng-template>
  72. <ng-template let-group pTemplate="body" let-i="rowIndex">
  73. <tr>
  74. <td>{{ i + 1 }}</td>
  75. <td>
  76. <p-button
  77. pTooltip="View Email in Group"
  78. tooltipPosition="top"
  79. icon="pi pi-eye"
  80. class=""
  81. (click)="viewDetails(group)"
  82. severity="secondary"
  83. >
  84. </p-button>
  85. </td>
  86. <td>
  87. <p-button
  88. pTooltip="Edit Group"
  89. tooltipPosition="top"
  90. icon="pi pi-pencil"
  91. class="btn btn-warning"
  92. (click)="editGroup(group)"
  93. severity="warning"
  94. >
  95. </p-button>
  96. <p-button
  97. pTooltip="Delete Group"
  98. tooltipPosition="top"
  99. icon="pi pi-trash"
  100. class="btn btn-danger"
  101. (click)="deleteGroup(group)"
  102. severity="danger"
  103. >
  104. </p-button>
  105. </td>
  106. <td>{{ group.groupName }}</td>
  107. <td>{{ group.createdDate | date: 'dd-MM-yyyy' }}</td>
  108. <td>{{ group.createdBy }}</td>
  109. <td>{{ group.updatedBy }}</td>
  110. <td>{{ group.groupName_ID }} </td>
  111.  
  112. </tr>
  113. </ng-template>
  114. </p-table>
  115. <p></p>
  116. </div>
  117. </div>
  118. </div>
  119.  
  120. <!-- MODE ADD PAGE LIST-->
  121. <div *ngIf="mode === 'add'">
  122. <p-dialog
  123. header="Header"
  124. [(visible)]="visible"
  125. [modal]="true"
  126. [style]="{ width: '30rem' }"
  127. (onHide)="closeDialogAD()"
  128. >
  129. <ng-template pTemplate="header">
  130. <div
  131. class="inline-flex align-items-center justify-content-center gap-2"
  132. >
  133. <span class="font-bold white-space-nowrap">
  134. Create Group
  135. </span>
  136. </div>
  137. </ng-template>
  138.  
  139. <span class="p-text-secondary block mb-5"
  140. >Please Insert a Group Name</span
  141. >
  142. <div class="flex align-items-center gap-3 mb-3">
  143. <input
  144. pInputText
  145. id="GroupName"
  146. [(ngModel)]="newGroupName"
  147. class="flex-auto"
  148. autocomplete="off"
  149. />
  150. </div>
  151.  
  152. <!-- Button Cancle AND Create -->
  153. <ng-template pTemplate="footer">
  154. <p-button
  155. icon="pi pi-check"
  156. label="CREATE"
  157. (click)="saveGroup()"
  158. />
  159. <p-button
  160. icon="pi pi-times"
  161. label="CANCLE"
  162. (click)="backToList()"
  163. severity="danger"
  164. />
  165. </ng-template>
  166. </p-dialog>
  167. </div>
  168.  
  169. <!-- EDIT GROUP PAGE LIST-->
  170. <div *ngIf="mode === 'ed'">
  171. <p-dialog
  172. header="Header"
  173. [(visible)]="visible"
  174. [modal]="true"
  175. [style]="{ width: '30rem' }"
  176. (onHide)="closeDialogED()"
  177. >
  178. <ng-template pTemplate="header">
  179. <div
  180. class="inline-flex align-items-center justify-content-center gap-2"
  181. >
  182. <span class="font-bold white-space-nowrap">
  183. Edit Group
  184. </span>
  185. </div>
  186. </ng-template>
  187.  
  188. <span class="p-text-secondary block mb-5"
  189. >Please Insert new a Group Name</span
  190. >
  191. <div class="flex align-items-center gap-3 mb-3">
  192. <input
  193. pInputText
  194. id="GroupName"
  195. [(ngModel)]="newGroupName"
  196. class="flex-auto"
  197. autocomplete="off"
  198. />
  199. </div>
  200.  
  201. <!-- Button Save AND Cancel -->
  202. <ng-template pTemplate="footer">
  203. <p-button
  204. icon="pi pi-save"
  205. label="Save"
  206. (click)="saveGroup()"
  207. severity="success"
  208. />
  209. <p-button
  210. icon="pi pi-times"
  211. label="Cancel"
  212. (click)="backToList()"
  213. severity="danger"
  214. />
  215. </ng-template>
  216. </p-dialog>
  217. </div>
  218.  
  219. <!-- Detail In GROUP PAGE LIST-->
  220. <div *ngIf="mode === 'dt'">
  221. <p-button
  222. pTooltip="Back to Group Mailing List"
  223. tooltipPosition="right"
  224. [rounded]="true"
  225. icon="pi pi-arrow-left"
  226. class="btn btn-danger"
  227. (click)="backToList()"
  228. />
  229.  
  230. <div class="text-center mb-3">
  231. <h3>Mailing List : {{ currentGroupName }}</h3>
  232. </div>
  233.  
  234. <div class="card shadow">
  235. <div class="card-body">
  236. <!-- Email -->
  237. <div class="grid-container mb-4 mt-2">
  238. <span class="p-float-label input-group">
  239. <input type="text" pInputText id="email" [(ngModel)]="searchFiltersEmail.email"
  240. placeholder="Search Email" />
  241. <label class="font-normal">Email</label>
  242. </span>
  243. <span></span>
  244. <span></span>
  245. </div>
  246.  
  247. <!-- Field Date, Create By, Modified By -->
  248. <div class="grid-container mb-4">
  249. <span class="p-float-label input-group">
  250. <input type="text" pInputText id="customerCode" [(ngModel)]="searchFiltersEmail.customerCode"
  251. placeholder="Search Customer Code" />
  252. <label class="font-normal">Customer Code</label>
  253. </span>
  254.  
  255. <span class="p-float-label input-group">
  256. <input type="text" pInputText id="customerName" [(ngModel)]="searchFiltersEmail.customerName"
  257. placeholder="Search Customer Name"/>
  258. <label class="font-normal">Customer Name</label>
  259. </span>
  260.  
  261. <p-button
  262. label="Search"
  263. severity="help"
  264. icon="pi pi-search"
  265. class="p-button-true ms-2"
  266. (click)="searchEmail()"
  267. />
  268. </div>
  269.  
  270. <div class="grid-container mb-3">
  271. <span class="p-float-label input-group">
  272. <input type="text" pInputText id="mobile" [(ngModel)]="searchFiltersEmail.mobile" />
  273. <label class="font-normal">Mobile</label>
  274. </span>
  275.  
  276. <span class="p-float-label input-group">
  277. <input type="text" pInputText id="telephone" [(ngModel)]="searchFiltersEmail.telephone" />
  278. <label class="font-normal">Telephone</label>
  279. </span>
  280.  
  281. <span class="p-float-label input-group">
  282. <input type="text" pInputText id="zipCode" [(ngModel)]="searchFiltersEmail.zipCode" />
  283. <label class="font-normal">Zipcode</label>
  284. </span>
  285. </div>
  286. <!-- Button Add Email ,Import ,Export -->
  287. <div class="flex align-items-center gap-2 mb-3 mt-4">
  288. <p-button
  289. class="btn btn-light"
  290. (click)="addEmail()"
  291. label="Add Email"
  292. icon="pi pi-plus"
  293. severity="success"
  294. />
  295. <p-button
  296. class="btn btn-light"
  297. (click)="importEmail()"
  298. icon="pi pi-download"
  299. label="Import"
  300. />
  301. <p-button
  302. class="btn btn-danger"
  303. (click)="exportFile()"
  304. label="Export"
  305. icon="pi pi-upload"
  306. severity="warning"
  307. />
  308. </div>
  309.  
  310. <!-- Table Mailing List in Group-->
  311. <p-table
  312. [value]="mailingList"
  313. [paginator]="true"
  314. [rows]="10"
  315. [rowsPerPageOptions]="[5, 10, 20, 50]"
  316. [showCurrentPageReport]="true"
  317. currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
  318. >
  319. <ng-template pTemplate="header">
  320. <tr>
  321. <th>No.</th>
  322. <th>Action</th>
  323. <th>Customer Code</th>
  324. <th>Customer Name</th>
  325. <th>Email</th>
  326. <th>Mobile</th>
  327. <th>Telephone</th>
  328. <th>Address</th>
  329. <th>Zipcode</th>
  330. </tr>
  331. </ng-template>
  332. <ng-template let-mail pTemplate="body" let-i="rowIndex">
  333. <tr>
  334. <td>{{ i + 1 }}</td>
  335. <td>
  336. <p-button
  337. pTooltip="Edit Customer"
  338. tooltipPosition="top"
  339. icon="pi pi-pencil"
  340. class="btn btn-warning"
  341. (click)="editCustomer(mail)"
  342. severity="warning"
  343. >
  344. </p-button>
  345. <p-button
  346. pTooltip="Delete Customer"
  347. tooltipPosition="top"
  348. icon="pi pi-trash"
  349. class="btn btn-danger"
  350. (click)="deleteCustomer(mail)"
  351. severity="danger"
  352. >
  353. </p-button>
  354. </td>
  355. <td>
  356. <a href="javascript:void(0);" (click)="viewCustomer(mail)" pTooltip="Tips : Can view Detail on click "
  357. tooltipPosition="top">
  358. {{ mail.customerCode }}
  359. </a>
  360. </td>
  361. <td>{{ mail.customerName }}</td>
  362. <td>{{ mail.emailAddress }}</td>
  363. <td>{{ mail.mobile }}</td>
  364. <td>{{ mail.telephone }}</td>
  365. <td>{{ mail.address }}</td>
  366. <td>{{ mail.zipcode }}</td>
  367. </tr>
  368. </ng-template>
  369. </p-table>
  370. <p></p>
  371. </div>
  372. </div>
  373. </div>
  374.  
  375. <!-- Popup IMPORT Mailing List Customer-->
  376. <div *ngIf="mode === 'im'">
  377. <p-dialog
  378. header="Header"
  379. [(visible)]="visible"
  380. [modal]="true"
  381. [style]="{ width: '30rem' }"
  382. (onHide)="closeDialogIm()"
  383. >
  384. <ng-template pTemplate="header">
  385. <div
  386. class="inline-flex align-items-center justify-content-center gap-2"
  387. >
  388. <span class="font-bold white-space-nowrap">
  389. Upload File
  390. </span>
  391. </div>
  392. </ng-template>
  393. <span class="p-text-secondary block mb-5"
  394. >Upload File Excel To Add Customers</span
  395. >
  396. <p-fileUpload
  397. name="demo[]"
  398. url="https://w...content-available-to-author-only...s.org/cdn/api/upload.php"
  399. (onUpload)="onUpload($event)"
  400. [multiple]="false"
  401. accept=".xlsx,.xls,.csv"
  402. [maxFileSize]="1000000"
  403. >
  404. <ng-template pTemplate="content">
  405. <ul *ngIf="uploadedFiles.length">
  406. <li *ngFor="let file of uploadedFiles">
  407. {{ file.name }} - {{ file.size }} bytes
  408. </li>
  409. </ul>
  410. </ng-template>
  411. </p-fileUpload>
  412. </p-dialog>
  413. </div>
  414.  
  415. <!-- Page Edit And Add New Email Customer <div *ngIf="mode === 'edm' || mode === 'addm'"> -->
  416. <div *ngIf="mode === 'edm' || mode === 'addm' || mode === 'vm'">
  417. <div>
  418. <div class="text-center mb-3">
  419. <h3 *ngIf="mode === 'vm'" >View(only) Mailing List</h3>
  420. <h3 *ngIf="mode === 'addm'" >Add Mailing List</h3>
  421. <h3 *ngIf="mode === 'edm'" >Edit Mailing List</h3>
  422. </div>
  423.  
  424. <div class="card shadow">
  425. <div class="grid-container mt-4">
  426. <span class="p-float-label input-group2">
  427. <input
  428. type="text"
  429. pInputText
  430. id="customerCode"
  431. [(ngModel)]="editingCustomer.customerCode"
  432. [ngClass]="{
  433. 'invalid-input': !editingCustomer.customerCode
  434. }"
  435. [disabled]="mode === 'edm'"
  436. [readonly]="mode === 'vm'"
  437. />
  438. <label class="font-normal">Customer Code</label>
  439. </span>
  440. <!-- [readonly]="mode === 'edm'" Change to [disabled]-->
  441.  
  442. <!-- Field Edit/Add Customer Name -->
  443. <span class="p-float-label input-group2">
  444. <input
  445. type="text"
  446. pInputText
  447. pTooltip="Tips : Enter your Fristname And Lastname"
  448. tooltipPosition="top"
  449. id="customerName"
  450. [ngClass]="{
  451. 'invalid-input': !editingCustomer.customerName
  452. }"
  453. [readonly]="mode === 'vm'"
  454. [(ngModel)]="editingCustomer.customerName"
  455. />
  456. <label class="font-normal">Customer Name</label>
  457. </span>
  458.  
  459. <span></span>
  460. </div>
  461.  
  462. <tr class="grid-container">
  463. <th>
  464. <div
  465. *ngIf="!editingCustomer.customerCode"
  466. class="error-message"
  467. >
  468. This field is required Customer Code.
  469. </div>
  470. </th>
  471.  
  472. <th>
  473. <div
  474. *ngIf="!editingCustomer.customerName"
  475. class="error-message"
  476. >
  477. This field is required Customer Name.
  478. </div>
  479. </th>
  480.  
  481. <th></th>
  482. </tr>
  483.  
  484. <div class="grid-container mt-4">
  485. <!-- Field Edit/ Add Email -->
  486. <span class="p-float-label input-group2">
  487. <input
  488. type="text"
  489. pInputText
  490. pTooltip="Tips : Enter your Email With @ "
  491. tooltipPosition="top"
  492. id="email"
  493. [ngClass]="{
  494. 'invalid-input': !editingCustomer.emailAddress || !editingCustomer.emailAddress.includes('@')
  495. }"
  496. [readonly]="mode === 'vm'"
  497. [(ngModel)]="editingCustomer.emailAddress"
  498. />
  499. <label class="font-normal">Email</label>
  500. </span>
  501.  
  502. <!-- Field Edit/ Add Mobile -->
  503. <span class="p-float-label input-group2">
  504. <input
  505. type="text"
  506. pInputText
  507. pTooltip="Tips : MobilePhone only Numeric"
  508. tooltipPosition="top"
  509. id="mobile"
  510. [(ngModel)]="editingCustomer.mobile"
  511. [readonly]="mode === 'vm'"
  512. [ngClass]="{
  513. 'invalid-input': !isNumericFieldValid(
  514. editingCustomer.mobile
  515. )
  516. }"
  517. />
  518. <label class="font-normal">Mobile</label>
  519. </span>
  520.  
  521. <!-- Field Edit/ Add Telephone -->
  522. <span class="p-float-label input-group2">
  523. <input
  524. type="text"
  525. pInputText
  526. pTooltip="Tips : Telephone only Numeric"
  527. tooltipPosition="top"
  528. id="telephone"
  529. [(ngModel)]="editingCustomer.telephone"
  530. [readonly]="mode === 'vm'"
  531. [ngClass]="{
  532. 'invalid-input': !isNumericFieldValid(
  533. editingCustomer.telephone
  534. )
  535. }"
  536. />
  537. <label class="font-normal">Telephone</label>
  538. </span>
  539. </div>
  540. <tr class="grid-container">
  541. <th>
  542. <div
  543. *ngIf="!editingCustomer.emailAddress || !editingCustomer.emailAddress.includes('@')"
  544. class="error-message"
  545. >
  546. This field is required E-mail.
  547. </div>
  548. </th>
  549. <th></th>
  550. <th></th>
  551. </tr>
  552.  
  553. <div class="grid-container mb-5 mt-4">
  554. <!-- Field Edit/ Add Address -->
  555. <span class="p-float-label input-group2">
  556. <input
  557. type="text"
  558. pInputText
  559. id="address"
  560. [readonly]="mode === 'vm'"
  561. [(ngModel)]="editingCustomer.address"
  562. />
  563. <label class="font-normal">Address</label>
  564. </span>
  565.  
  566. <!-- Field Edit/ Add Zipcode -->
  567. <span class="p-float-label input-group2">
  568. <input
  569. type="text"
  570. pInputText
  571. pTooltip="Tips : Zipcode only Numeric"
  572. tooltipPosition="top"
  573. id="zipCode"
  574. [(ngModel)]="editingCustomer.zipcode"
  575. [readonly]="mode === 'vm'"
  576. [ngClass]="{
  577. 'invalid-input': !isNumericFieldValid(
  578. editingCustomer.zipcode
  579. )
  580. }"
  581. />
  582. <label class="font-normal">Zipcode</label>
  583. </span>
  584. <span></span>
  585. </div>
  586. <br /><br />
  587. <br />
  588. <br />
  589.  
  590. <!-- Button Save and Cancel Edit/Add Email. -->
  591. <div class="text-right mt-5">
  592.  
  593. <p-button *ngIf="mode === 'addm'"
  594. icon="pi pi-save"
  595. label="Save"
  596. (click)="saveEmail()"
  597. severity="success"
  598. class="mr-2"
  599. ></p-button>
  600.  
  601. <p-button *ngIf="mode === 'edm'"
  602. icon="pi pi-save"
  603. label="Confrim"
  604. (click)="confirmEditCustomer()"
  605. severity="success"
  606. class="mr-2"
  607. ></p-button>
  608.  
  609. <p-button
  610. icon="pi pi-times"
  611. label="Cancel"
  612. (click)="closeDialogIm()"
  613. severity="danger"
  614. ></p-button>
  615.  
  616. </div>
  617. </div>
  618. </div>
  619. </div>
  620.  
  621. <!-- Popup Delete Group -->
  622. <div *ngIf="mode === 'delgr'">
  623. <p-dialog
  624. header="Header"
  625. [(visible)]="visible"
  626. [modal]="true"
  627. [style]="{ width: '30rem' }"
  628. (onHide)="closeDialogED()"
  629. >
  630. <ng-template pTemplate="header">
  631. <div
  632. class="inline-flex align-items-center justify-content-center gap-2"
  633. >
  634. <span class="font-bold white-space-nowrap">
  635. Delete Group
  636. </span>
  637. </div>
  638. </ng-template>
  639. <span class="p-text-secondary block mb-5"
  640. >Are you sure You want to delete Group name?</span
  641. >
  642. <ng-template pTemplate="footer">
  643. <p-button
  644. icon="pi pi-trash"
  645. label="Delete"
  646. severity="danger"
  647. (click)="confirmDeleteGroup()"
  648. />
  649. <p-button
  650. icon="pi pi-times"
  651. [text]="true"
  652. label="Cancel"
  653. [plain]="true"
  654. (click)="backToList()"
  655.  
  656. />
  657. </ng-template>
  658. </p-dialog>
  659. </div>
  660.  
  661. <!-- Popup Delete Customer in Group -->
  662. <div *ngIf="mode === 'delcm'">
  663. <p-dialog
  664. header="Header"
  665. [(visible)]="visible"
  666. [modal]="true"
  667. [style]="{ width: '30rem' }"
  668. (onHide)="closeDialogIm()"
  669. >
  670. <ng-template pTemplate="header">
  671. <div
  672. class="inline-flex align-items-center justify-content-center gap-2"
  673. >
  674. <span class="font-bold white-space-nowrap">
  675. Delete Email
  676. </span>
  677. </div>
  678. </ng-template>
  679. <span class="p-text-secondary block mb-5"
  680. >Are you sure You want to delete Email?</span
  681. >
  682. <ng-template pTemplate="footer">
  683. <p-button
  684. icon="pi pi-check"
  685. label="CONFIRM"
  686. (click)="confirmDeleteCustomer()"
  687. severity="danger"
  688. />
  689. <p-button
  690. icon="pi pi-times"
  691. label="CANCEL"
  692. [text]="true"
  693. [plain]="true"
  694. (click)="backToMail()"
  695. />
  696. </ng-template>
  697. </p-dialog>
  698. </div>
  699.  
  700. <!-- Popup Export After Click Button -->
  701. <div *ngIf="mode === 'export'">
  702.  
  703. </div>
  704.  
  705. <!-- Dialog Confrim Edit -->
  706. <div *ngIf="mode === 'Confrim Edit'">
  707. <p-dialog
  708. header="Header"
  709. [(visible)]="visible"
  710. [modal]="true"
  711. [style]="{ width: '25rem' }"
  712. (onHide)="closeDialogAD()"
  713. >
  714. <ng-template pTemplate="header">
  715. <div
  716. class="inline-flex align-items-center justify-content-center gap-2"
  717. >
  718. <span class="font-bold white-space-nowrap">
  719. Create Group
  720. </span>
  721. </div>
  722. </ng-template>
  723. <span class="p-text-secondary block mb-5"
  724. >Please Insert a Group Name</span
  725. >
  726. <div class="flex align-items-center gap-3 mb-3">
  727. <input
  728. pInputText
  729. id="GroupName"
  730. [(ngModel)]="newGroupName"
  731. class="flex-auto"
  732. autocomplete="off"
  733. />
  734. </div>
  735.  
  736. <ng-template pTemplate="footer">
  737. <p-button
  738. icon="pi pi-check"
  739. label="CREATE"
  740. (click)="saveGroup()"
  741. />
  742. <p-button
  743. icon="pi pi-times"
  744. label="CANCLE"
  745. (click)="backToList()"
  746. severity="danger"
  747. />
  748. </ng-template>
  749. </p-dialog>
  750. </div>
  751. </div>
Success #stdin #stdout 0.03s 25832KB
stdin
Standard input is empty
stdout
<p-toast></p-toast>
<div class="container">
    <!--  <div *ngIf="mode === 'list'"> -->
    <div *ngIf="mode === 'list'">
        <p-button
            [rounded]="true"
            icon="pi pi-arrow-right"
            class="btn btn-danger"
            (click)="backToMail()"
            label="Test To Mailing List"
        />

        <div class="text-center mb-3">
            <h3>Group Mailing List</h3>
        </div>
        <div class="card shadow">
            <div class="card-body">
                <div class="grid-container mb-4 mt-2">
                    <span class="p-float-label input-group">
                        <input
                            type="text"
                            pInputText
                            id="groupName"
                            [(ngModel)]="searchFilters.groupName"
                        />
                        <label class="font-normal">Group Name</label>
                    </span>
                    <!-- Button Search Group Name -->
                    <p-button
                        label="Search"
                        icon="pi pi-search"
                        [raised]="true"
                        severity="help"
                        (click)="searchGroups()"
                    />
                    <span></span>
                </div>

                <!--Button ADD Group -->

                <div class="text-end mb-4 mt-3">
                    <p-button
                        class="btn btn-light"
                        (click)="addGroup()"
                        icon="pi pi-plus"
                        label="Add group"
                        severity="success"
                    />
                </div>

                <!--Table of Group Name -->
                <p-table
                    [value]="filteredGroupList"
                    [paginator]="true"
                    [rows]="10"
                    [rowsPerPageOptions]="[5, 10, 20]"
                    [showCurrentPageReport]="true"
                    currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
                >
                    <!-- Header Table -->
                    <ng-template pTemplate="header">
                        <tr>
                            <th>No.</th>
                            <th>Detail</th>
                            <th>Action</th>
                            <th>Group Name</th>
                            <th>Create Date</th>
                            <th>Create By</th>
                            <th>Modified By</th>
                        </tr>
                    </ng-template>
                    <ng-template let-group pTemplate="body" let-i="rowIndex">
                        <tr>
                            <td>{{ i + 1 }}</td>
                            <td>
                                <p-button
                                pTooltip="View Email in Group" 
                                tooltipPosition="top"
                                    icon="pi pi-eye"
                                    class=""
                                    (click)="viewDetails(group)"
                                    severity="secondary"
                                >
                                </p-button>
                            </td>
                            <td>
                                <p-button
                                pTooltip="Edit Group" 
                                tooltipPosition="top"
                                    icon="pi pi-pencil"
                                    class="btn btn-warning"
                                    (click)="editGroup(group)"
                                    severity="warning"
                                >
                                </p-button>
                                <p-button
                                pTooltip="Delete Group" 
                                tooltipPosition="top"
                                    icon="pi pi-trash"
                                    class="btn btn-danger"
                                    (click)="deleteGroup(group)"
                                    severity="danger"
                                >
                                </p-button>
                            </td>
                            <td>{{ group.groupName }}</td>
                            <td>{{ group.createdDate | date: 'dd-MM-yyyy' }}</td>
                            <td>{{ group.createdBy }}</td>
                            <td>{{ group.updatedBy }}</td>
                            <td>{{ group.groupName_ID }} </td>
                            
                        </tr>
                    </ng-template>
                </p-table>
                <p></p>
            </div>
        </div>
    </div>

    <!-- MODE ADD PAGE LIST-->
    <div *ngIf="mode === 'add'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '30rem' }"
            (onHide)="closeDialogAD()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Create Group
                    </span>
                </div>
            </ng-template>

            <span class="p-text-secondary block mb-5"
                >Please Insert a Group Name</span
            >
            <div class="flex align-items-center gap-3 mb-3">
                <input
                    pInputText
                    id="GroupName"
                    [(ngModel)]="newGroupName"
                    class="flex-auto"
                    autocomplete="off"
                />
            </div>

            <!-- Button Cancle AND Create -->
            <ng-template pTemplate="footer">
                <p-button
                    icon="pi pi-check"
                    label="CREATE"
                    (click)="saveGroup()"
                />
                <p-button
                    icon="pi pi-times"
                    label="CANCLE"
                    (click)="backToList()"
                    severity="danger"
                />
            </ng-template>
        </p-dialog>
    </div>

    <!-- EDIT GROUP PAGE LIST-->
    <div *ngIf="mode === 'ed'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '30rem' }"
            (onHide)="closeDialogED()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Edit Group
                    </span>
                </div>
            </ng-template>

            <span class="p-text-secondary block mb-5"
                >Please Insert new a Group Name</span
            >
            <div class="flex align-items-center gap-3 mb-3">
                <input
                    pInputText
                    id="GroupName"
                    [(ngModel)]="newGroupName"
                    class="flex-auto"
                    autocomplete="off"
                />
            </div>

            <!-- Button Save AND Cancel -->
            <ng-template pTemplate="footer">
                <p-button
                    icon="pi pi-save"
                    label="Save"
                    (click)="saveGroup()"
                    severity="success"
                />
                <p-button
                    icon="pi pi-times"
                    label="Cancel"
                    (click)="backToList()"
                    severity="danger"
                />
            </ng-template>
        </p-dialog>
    </div>

    <!-- Detail In GROUP PAGE LIST-->
    <div *ngIf="mode === 'dt'">
        <p-button
            pTooltip="Back to Group Mailing List" 
            tooltipPosition="right"
            [rounded]="true"
            icon="pi pi-arrow-left"
            class="btn btn-danger"
            (click)="backToList()"
        />

        <div class="text-center mb-3">
            <h3>Mailing List : {{ currentGroupName }}</h3>
        </div>

        <div class="card shadow">
            <div class="card-body">
                <!-- Email -->
                <div class="grid-container mb-4 mt-2">
                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="email"  [(ngModel)]="searchFiltersEmail.email"  
                        placeholder="Search Email" />
                        <label class="font-normal">Email</label>
                    </span>
                    <span></span>
                    <span></span>
                </div>

                <!-- Field Date, Create By, Modified By -->
                <div class="grid-container mb-4">
                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="customerCode"  [(ngModel)]="searchFiltersEmail.customerCode"  
                        placeholder="Search Customer Code" />
                        <label class="font-normal">Customer Code</label>
                    </span>

                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="customerName"  [(ngModel)]="searchFiltersEmail.customerName"  
                        placeholder="Search Customer Name"/>
                        <label class="font-normal">Customer Name</label>
                    </span>

                    <p-button
                        label="Search"
                        severity="help"
                        icon="pi pi-search"
                        class="p-button-true ms-2"
                        (click)="searchEmail()"
                    />
                </div>

                <div class="grid-container mb-3">
                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="mobile" [(ngModel)]="searchFiltersEmail.mobile" />
                        <label class="font-normal">Mobile</label>
                    </span>

                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="telephone" [(ngModel)]="searchFiltersEmail.telephone" />
                        <label class="font-normal">Telephone</label>
                    </span>

                    <span class="p-float-label input-group">
                        <input type="text" pInputText id="zipCode" [(ngModel)]="searchFiltersEmail.zipCode" />
                        <label class="font-normal">Zipcode</label>
                    </span>
                </div>
                <!-- Button Add Email ,Import ,Export -->
                <div class="flex align-items-center gap-2 mb-3 mt-4">
                    <p-button
                        class="btn btn-light"
                        (click)="addEmail()"
                        label="Add Email"
                        icon="pi pi-plus"
                        severity="success"
                    />
                    <p-button
                        class="btn btn-light"
                        (click)="importEmail()"
                        icon="pi pi-download"
                        label="Import"
                    />
                    <p-button
                        class="btn btn-danger"
                        (click)="exportFile()"
                        label="Export"
                        icon="pi pi-upload"
                        severity="warning"
                    />
                </div>

                <!-- Table Mailing List in Group-->
                <p-table
                    [value]="mailingList"
                    [paginator]="true"
                    [rows]="10"
                    [rowsPerPageOptions]="[5, 10, 20, 50]"
                    [showCurrentPageReport]="true"
                    currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
                >
                    <ng-template pTemplate="header">
                        <tr>
                            <th>No.</th>
                            <th>Action</th>
                            <th>Customer Code</th>
                            <th>Customer Name</th>
                            <th>Email</th>
                            <th>Mobile</th>
                            <th>Telephone</th>
                            <th>Address</th>
                            <th>Zipcode</th>
                        </tr>
                    </ng-template>
                    <ng-template let-mail pTemplate="body" let-i="rowIndex">
                        <tr>
                            <td>{{ i + 1 }}</td>
                            <td>
                                <p-button
                                pTooltip="Edit Customer" 
                                tooltipPosition="top"
                                    icon="pi pi-pencil"
                                    class="btn btn-warning"
                                    (click)="editCustomer(mail)"
                                    severity="warning"
                                >
                                </p-button>
                                <p-button
                                pTooltip="Delete Customer" 
                                tooltipPosition="top"
                                    icon="pi pi-trash"
                                    class="btn btn-danger"
                                    (click)="deleteCustomer(mail)"
                                    severity="danger"
                                >
                                </p-button>
                            </td>
                            <td>
                                <a href="javascript:void(0);" (click)="viewCustomer(mail)"  pTooltip="Tips : Can view Detail on click " 
                                tooltipPosition="top">
                                {{ mail.customerCode }}
                            </a>
                            </td>
                            <td>{{ mail.customerName }}</td>
                            <td>{{ mail.emailAddress }}</td>
                            <td>{{ mail.mobile }}</td>
                            <td>{{ mail.telephone }}</td>
                            <td>{{ mail.address }}</td>
                            <td>{{ mail.zipcode }}</td>
                        </tr>
                    </ng-template>
                </p-table>
                <p></p>
            </div>
        </div>
    </div>

    <!-- Popup IMPORT Mailing List Customer-->
    <div *ngIf="mode === 'im'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '30rem' }"
            (onHide)="closeDialogIm()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Upload File
                    </span>
                </div>
            </ng-template>
            <span class="p-text-secondary block mb-5"
                >Upload File Excel To Add Customers</span
            >
            <p-fileUpload
                name="demo[]"
                url="https://w...content-available-to-author-only...s.org/cdn/api/upload.php"
                (onUpload)="onUpload($event)"
                [multiple]="false"
                accept=".xlsx,.xls,.csv"
                [maxFileSize]="1000000"
            >
                <ng-template pTemplate="content">
                    <ul *ngIf="uploadedFiles.length">
                        <li *ngFor="let file of uploadedFiles">
                            {{ file.name }} - {{ file.size }} bytes
                        </li>
                    </ul>
                </ng-template>
            </p-fileUpload>
        </p-dialog>
    </div>

    <!-- Page Edit And Add New Email Customer <div *ngIf="mode === 'edm' || mode === 'addm'"> -->
    <div *ngIf="mode === 'edm' || mode === 'addm' || mode === 'vm'">
        <div>
            <div class="text-center mb-3">
                <h3 *ngIf="mode === 'vm'" >View(only) Mailing List</h3>
                <h3 *ngIf="mode === 'addm'" >Add Mailing List</h3>
                <h3 *ngIf="mode === 'edm'" >Edit Mailing List</h3>
            </div>

            <div class="card shadow">
                <div class="grid-container mt-4">
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            id="customerCode"
                            [(ngModel)]="editingCustomer.customerCode"
                            [ngClass]="{
                                'invalid-input': !editingCustomer.customerCode
                            }"
                            [disabled]="mode === 'edm'"
                            [readonly]="mode === 'vm'"
                        />
                        <label class="font-normal">Customer Code</label>
                    </span>
                    <!-- [readonly]="mode === 'edm'" Change to [disabled]-->

                    <!-- Field Edit/Add Customer Name -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            pTooltip="Tips : Enter your Fristname And Lastname" 
                            tooltipPosition="top"
                            id="customerName"
                            [ngClass]="{
                                'invalid-input': !editingCustomer.customerName
                            }"
                            [readonly]="mode === 'vm'"
                            [(ngModel)]="editingCustomer.customerName"
                        />
                        <label class="font-normal">Customer Name</label>
                    </span>

                    <span></span>
                </div>

                <tr class="grid-container">
                    <th>
                        <div
                            *ngIf="!editingCustomer.customerCode"
                            class="error-message"
                        >
                            This field is required Customer Code.
                        </div>
                    </th>

                    <th>
                        <div
                            *ngIf="!editingCustomer.customerName"
                            class="error-message"
                        >
                            This field is required Customer Name.
                        </div>
                    </th>

                    <th></th>
                </tr>

                <div class="grid-container mt-4">
                    <!-- Field Edit/ Add Email -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            pTooltip="Tips : Enter your Email With @ " 
                            tooltipPosition="top"
                            id="email"
                            [ngClass]="{
                                'invalid-input': !editingCustomer.emailAddress || !editingCustomer.emailAddress.includes('@')
                            }"
                            [readonly]="mode === 'vm'"
                            [(ngModel)]="editingCustomer.emailAddress"
                        />
                        <label class="font-normal">Email</label>
                    </span>

                    <!-- Field Edit/ Add Mobile -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            pTooltip="Tips : MobilePhone only Numeric" 
                            tooltipPosition="top"
                            id="mobile"
                            [(ngModel)]="editingCustomer.mobile"
                            [readonly]="mode === 'vm'"
                            [ngClass]="{
                                'invalid-input': !isNumericFieldValid(
                                    editingCustomer.mobile
                                )
                            }"
                        />
                        <label class="font-normal">Mobile</label>
                    </span>

                    <!-- Field Edit/ Add Telephone -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            pTooltip="Tips : Telephone only Numeric" 
                            tooltipPosition="top"
                            id="telephone"
                            [(ngModel)]="editingCustomer.telephone"
                            [readonly]="mode === 'vm'"
                            [ngClass]="{
                                'invalid-input': !isNumericFieldValid(
                                    editingCustomer.telephone
                                )
                            }"
                        />
                        <label class="font-normal">Telephone</label>
                    </span>
                </div>
                <tr class="grid-container">
                <th>
                    <div
                        *ngIf="!editingCustomer.emailAddress || !editingCustomer.emailAddress.includes('@')"
                        class="error-message"
                    >
                        This field is required E-mail.
                    </div>
                </th>
                <th></th>
                <th></th>
            </tr>

                <div class="grid-container mb-5 mt-4">
                    <!-- Field Edit/ Add Address -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            id="address"
                            [readonly]="mode === 'vm'"
                            [(ngModel)]="editingCustomer.address"
                        />
                        <label class="font-normal">Address</label>
                    </span>

                    <!-- Field Edit/ Add Zipcode -->
                    <span class="p-float-label input-group2">
                        <input
                            type="text"
                            pInputText
                            pTooltip="Tips : Zipcode only Numeric" 
                            tooltipPosition="top"
                            id="zipCode"
                            [(ngModel)]="editingCustomer.zipcode"
                            [readonly]="mode === 'vm'"
                            [ngClass]="{
                                'invalid-input': !isNumericFieldValid(
                                    editingCustomer.zipcode
                                )
                            }"
                        />
                        <label class="font-normal">Zipcode</label>
                    </span>
                    <span></span>
                </div>
                <br /><br />
                <br />
                <br />

                <!-- Button Save and Cancel Edit/Add Email. -->
                <div class="text-right mt-5">
                    
                    <p-button *ngIf="mode === 'addm'"
                        icon="pi pi-save"
                        label="Save"
                        (click)="saveEmail()"
                        severity="success"
                        class="mr-2"
                    ></p-button>

                    <p-button *ngIf="mode === 'edm'"
                        icon="pi pi-save"
                        label="Confrim"
                        (click)="confirmEditCustomer()"
                        severity="success"
                        class="mr-2"
                    ></p-button>

                    <p-button
                        icon="pi pi-times"
                        label="Cancel"
                        (click)="closeDialogIm()"
                        severity="danger"
                    ></p-button>

                </div>
            </div>
        </div>
    </div>

    <!-- Popup Delete Group -->
    <div *ngIf="mode === 'delgr'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '30rem' }"
            (onHide)="closeDialogED()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Delete Group
                    </span>
                </div>
            </ng-template>
            <span class="p-text-secondary block mb-5"
                >Are you sure You want to delete Group name?</span
            >
            <ng-template pTemplate="footer">
                <p-button
                    icon="pi pi-trash"
                    label="Delete"
                    severity="danger"
                    (click)="confirmDeleteGroup()"
                />
                <p-button
                    icon="pi pi-times"
                    [text]="true"
                    label="Cancel"
                    [plain]="true"
                    (click)="backToList()"
                    
                />
            </ng-template>
        </p-dialog>
    </div>

    <!-- Popup Delete Customer in Group -->
    <div *ngIf="mode === 'delcm'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '30rem' }"
            (onHide)="closeDialogIm()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Delete Email
                    </span>
                </div>
            </ng-template>
            <span class="p-text-secondary block mb-5"
                >Are you sure You want to delete Email?</span
            >
            <ng-template pTemplate="footer">
                <p-button
                    icon="pi pi-check"
                    label="CONFIRM"
                    (click)="confirmDeleteCustomer()"
                    severity="danger"
                />
                <p-button
                    icon="pi pi-times"
                    label="CANCEL"
                    [text]="true"
                    [plain]="true"
                    (click)="backToMail()"
                />
            </ng-template>
        </p-dialog>
    </div>

    <!-- Popup Export After Click Button -->
    <div *ngIf="mode === 'export'">
        
    </div>

    <!-- Dialog Confrim Edit -->
    <div *ngIf="mode === 'Confrim Edit'">
        <p-dialog
            header="Header"
            [(visible)]="visible"
            [modal]="true"
            [style]="{ width: '25rem' }"
            (onHide)="closeDialogAD()"
        >
            <ng-template pTemplate="header">
                <div
                    class="inline-flex align-items-center justify-content-center gap-2"
                >
                    <span class="font-bold white-space-nowrap">
                        Create Group
                    </span>
                </div>
            </ng-template>
            <span class="p-text-secondary block mb-5"
                >Please Insert a Group Name</span
            >
            <div class="flex align-items-center gap-3 mb-3">
                <input
                    pInputText
                    id="GroupName"
                    [(ngModel)]="newGroupName"
                    class="flex-auto"
                    autocomplete="off"
                />
            </div>

            <ng-template pTemplate="footer">
                <p-button
                    icon="pi pi-check"
                    label="CREATE"
                    (click)="saveGroup()"
                />
                <p-button
                    icon="pi pi-times"
                    label="CANCLE"
                    (click)="backToList()"
                    severity="danger"
                />
            </ng-template>
        </p-dialog>
    </div>
</div>