Angular Web App
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

178 rindas
4.8 KiB

  1. import { Component, OnInit } from '@angular/core';
  2. import { DateInputProperties } from 'src/app/widgets/form/date-input/date-input.component';
  3. import { GenericInputProperties } from 'src/app/widgets/form/generic-input/generic-input.component';
  4. import { SelectInputProperties } from 'src/app/widgets/form/select-input/select-input.component';
  5. @Component({
  6. selector: 'app-register-business',
  7. templateUrl: './register-business.component.html',
  8. styleUrls: ['./register-business.component.scss']
  9. })
  10. export class RegisterBusinessComponent implements OnInit {
  11. formState: 'CHECK_NAME' | 'INIT_REGISTER' |
  12. 'REGISTER_FORM' | 'SELECT_PLAN' |
  13. 'ACKNOWLEDGEMENT' | 'RECEIPT' | undefined = 'CHECK_NAME';
  14. nameToCheck: string = 'JK Enterprises ACRA';
  15. isAppealing: boolean = false;
  16. agreeToReserve: boolean = false;
  17. error?: {
  18. message: string,
  19. isUnique: boolean,
  20. isInvalid: boolean,
  21. }
  22. selectedPaymentTab: 'overview'|'details' = 'overview';
  23. years: Array<number> = (new Array(15)).fill(1).map((value, index) => index + 1);
  24. paymentChild: Window | null = null;
  25. childCheck: number | undefined;
  26. registerForm: Array<SelectInputProperties|DateInputProperties|GenericInputProperties> = [{
  27. name: 'Entity Type',
  28. type: 'select',
  29. options: [
  30. 'BUSINESS',
  31. 'LOCAL COMPANY',
  32. 'LIMITED LIABILITY PARTNERSHIP',
  33. 'FOREIGN COMPANY',
  34. 'LIMITED PARTNERSHIP',
  35. 'PUBLIC ACCOUNTING FIRM'
  36. ]
  37. }, {
  38. name: 'Company Category',
  39. type: 'select',
  40. options: [
  41. 'PUBLIC COMPANY LIMITED BY SHARES',
  42. 'PUBLIC COMPANY LIMITED BY GUARANTEE',
  43. 'PRIVATE COMPANY LIMITED BY SHARES',
  44. 'EXEMPT PRIVATE COMPANY LIMITED BY SHARES'
  45. ]
  46. }, {
  47. name: 'Company Suffix',
  48. type: 'select',
  49. options: ['LLC', 'LTD', 'PVT LTD', 'INC']
  50. }, {
  51. name: 'Drop the Suffix "Limited" or "Berhad"?',
  52. type: 'select',
  53. options: ['YES', 'NO']
  54. }];
  55. acknowledgementDetails: Array<{
  56. name: string,
  57. value: string | number,
  58. amount?: number,
  59. highlight?: boolean,
  60. }> = [{
  61. name: 'UEM',
  62. value: '---'
  63. }, {
  64. name: 'Entity Name',
  65. value: this.nameToCheck
  66. }, {
  67. name: 'Transaction Number',
  68. value: '39047729362923293',
  69. highlight: true,
  70. }, {
  71. name: 'Receipt Number',
  72. value: 'ACRA38293',
  73. highlight: true
  74. }, {
  75. name: 'EP Reference No.',
  76. value: '20910038829384470'
  77. }, {
  78. name: 'Payment Date',
  79. value: '06/11/2021 11:28:01'
  80. }, {
  81. name: 'Description',
  82. value: 'Application for Business Name',
  83. amount: 15
  84. }];
  85. receiptDetails: Array<{
  86. name: string,
  87. value: string | number,
  88. }> = [{
  89. name: 'Receipt Number',
  90. value: 'ACRA38293',
  91. }, {
  92. name: 'ARN',
  93. value: 'ARN2021110294038',
  94. }, {
  95. name: 'EP Reference No.',
  96. value: '20910038829384470'
  97. }, {
  98. name: 'Tax ID',
  99. value: 'M9-0C038921',
  100. }, {
  101. name: 'Paid By',
  102. value: 'KOH YA TING',
  103. }, {
  104. name: 'Payment Date',
  105. value: '06/11/2021 11:28:01'
  106. }, {
  107. name: 'Paid Via',
  108. value: 'Net Banking',
  109. }];
  110. constructor() { }
  111. ngOnInit(): void {
  112. }
  113. confirmName() {
  114. if (!this.error?.isUnique) {
  115. this.isAppealing = true;
  116. }
  117. this.formState = 'REGISTER_FORM';
  118. }
  119. goBackToFormDetails() {
  120. if (typeof this.childCheck !== 'undefined') {
  121. window.clearInterval(this.childCheck);
  122. this.childCheck = undefined;
  123. }
  124. if (this.paymentChild && !this.paymentChild.closed) {
  125. this.paymentChild?.close()
  126. }
  127. this.formState = 'REGISTER_FORM'
  128. }
  129. payForReservation() {
  130. this.paymentChild = window.open('/mock', '_blank', 'toolbar=0,status=0,width=626,height=436');
  131. this.childCheck = window.setInterval(() => {
  132. if (this.paymentChild && this.paymentChild.closed) {
  133. this.formState = 'ACKNOWLEDGEMENT';
  134. window.clearInterval(this.childCheck);
  135. this.childCheck = undefined;
  136. }
  137. }, 1000);
  138. }
  139. checkName() {
  140. this.formState = 'INIT_REGISTER';
  141. if (this.nameToCheck === 'JK Enterprises') {
  142. this.error = {
  143. message: this.nameToCheck + ' is unavailable',
  144. isUnique: false,
  145. isInvalid: false,
  146. };
  147. } else {
  148. this.error = {
  149. message: this.nameToCheck + ' is available',
  150. isUnique: true,
  151. isInvalid: false
  152. };
  153. }
  154. }
  155. print() {
  156. window.print();
  157. }
  158. }