Commit 012ae85233400b63fa40b25b4fb9c77f509347c4

Authored by DESKTOP-P23T5P2\NewTeryEiEi
1 parent bf1ff55d
Exists in master

ปุ่มค้นหา department หน้า follow

src/app/dashboard/dashboard.component.html
... ... @@ -949,6 +949,10 @@
949 949 </div>
950 950 <br>
951 951 <br>
  952 + <button type="button" class="btn btn-circle button" *ngFor="let nameD of ButtonValueDepart" (click)="getButton9Depart(nameD.valueN);getButton9DepartOnhold(nameD.valueN);"
  953 + style="margin-left: 5px; margin-top: 10px;">{{ nameD.name }}
  954 + </button>
  955 + <hr>
952 956 <button type="button" class="btn btn-circle button" *ngFor="let name of ButtonValue" (click)="getButton9(name.valueN);getButton9Onhold(name.valueN);"
953 957 style="margin-left: 5px; margin-top: 10px;"><span class="badge2" [hidden]="!name.num" style="float: right; position: absolute; margin-top: -15px; margin-left: 19px;"> {{ name.num }} </span> {{ name.name }}
954 958 </button>
... ...
src/app/dashboard/dashboard.component.ts
... ... @@ -998,6 +998,7 @@ setInterval(async () =&gt; {
998 998 r.birth_date = this._common.convertDate(r.birth_date);
999 999 this.resultNum9 = this.resultData9.length;
1000 1000 this.Show9.push(r);
  1001 + this.Show9Depart.push(r);
1001 1002 this.Type9.push(r.type);
1002 1003 t9.push(r.type);
1003 1004 r.t9 = t9;
... ... @@ -1076,6 +1077,7 @@ try {
1076 1077 this.resultDataOnHold9[i].link = this._common.decodeURI(this.resultDataOnHold9[i].link);
1077 1078 this.resultDataOnHold9[i].birth_date = this._common.convertDate(this.resultDataOnHold9[i].birth_date);
1078 1079 this.Show9Onhold.push(this.resultDataOnHold9[i]);
  1080 + this.Show9DepartOnhold.push(this.resultDataOnHold9[i]);
1079 1081 }
1080 1082 } else {
1081 1083 this.resultDataOnHold9 = [];
... ... @@ -1758,8 +1760,43 @@ setInterval(async () =&gt; {
1758 1760 // this.Type9.push(this.NumType9);
1759 1761 }
1760 1762  
  1763 + getButton9Depart(valueN) {
  1764 + console.log(valueN);
  1765 +
  1766 + if (this.Show9Depart.length === 0) {
  1767 + return this.Show9Depart;
  1768 + }
  1769 +
  1770 + const resultArray = [];
  1771 + for (const item of this.Show9Depart) {
  1772 + // console.log('item: ', item);
  1773 +
  1774 + let st = '';
  1775 +
  1776 + if (item['department']) {
  1777 + st = item['department'].toLowerCase();
  1778 + }
  1779 +
  1780 + const string2 = valueN.toLowerCase();
  1781 + if (st.startsWith(string2)) {
  1782 + console.log(st);
  1783 + resultArray.push(item);
  1784 + }
  1785 +
  1786 + }
  1787 + if (resultArray.length === 0) {
  1788 + if (valueN !== '') {
  1789 + this.showSecret1 = true;
  1790 + }
  1791 + } else if (resultArray.length > 0) {
  1792 + this.showSecret1 = false;
  1793 + }
  1794 + this.resultData9 = resultArray;
  1795 +
  1796 +}
  1797 +
1761 1798 /* buttondataOnhold9 */
1762   - getButton9Onhold(valueN) {
  1799 + getButton9Onhold(valueN) {
1763 1800 console.log(valueN);
1764 1801  
1765 1802 if (this.Show9Onhold.length === 0) {
... ... @@ -1794,6 +1831,41 @@ setInterval(async () =&gt; {
1794 1831  
1795 1832 }
1796 1833  
  1834 +getButton9DepartOnhold(valueN) {
  1835 + console.log(valueN);
  1836 +
  1837 + if (this.Show9DepartOnhold.length === 0) {
  1838 + return this.Show9DepartOnhold;
  1839 + }
  1840 +
  1841 + const resultArray = [];
  1842 + for (const item of this.Show9DepartOnhold) {
  1843 + // console.log('item: ', item);
  1844 +
  1845 + let st = '';
  1846 +
  1847 + if (item['department']) {
  1848 + st = item['department'].toLowerCase();
  1849 + }
  1850 +
  1851 + const string2 = valueN.toLowerCase();
  1852 + if (st.startsWith(string2)) {
  1853 + console.log(st);
  1854 + resultArray.push(item);
  1855 + }
  1856 +
  1857 + }
  1858 + if (resultArray.length === 0) {
  1859 + if (valueN !== '') {
  1860 + this.showSecret2 = true;
  1861 + }
  1862 + } else if (resultArray.length > 0) {
  1863 + this.showSecret2 = false;
  1864 + }
  1865 + this.resultDataOnHold9 = resultArray;
  1866 +
  1867 +}
  1868 +
1797 1869 ///////////// Get data come to use//////////////////////
1798 1870  
1799 1871  
... ...