Ionic + React accounts android app and PWA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

165 regels
6.3 KiB

  1. import { IonButton, IonContent, IonDatetime, IonInput, IonPage } from '@ionic/react';
  2. import { ReactComponent as CogIcon } from 'ionicons/dist/svg/cog-outline.svg';
  3. import { ReactComponent as LineChartIcon } from 'ionicons/dist/svg/stats-chart.svg';
  4. import styles from './accounts.module.scss';
  5. import itemCardStyles from '../../components/item-card/itemCard.module.scss';
  6. import { ItemCard } from '../../components/item-card/itemCard';
  7. import { format } from 'date-fns';
  8. const sampleInvoiceData = [{
  9. invoice: {
  10. id: '2021-22/50',
  11. date: new Date().toString(),
  12. status: 'due',
  13. },
  14. client: {
  15. name: 'Swasti',
  16. logo: 'https://cais.usc.edu/wp-content/uploads/2019/08/swasti-logo-2.23.png',
  17. project: {
  18. name: 'DiceFlow',
  19. contract: {
  20. name: 'Retainer contract',
  21. amount: '₹ 5,00,000',
  22. },
  23. }
  24. }
  25. }, {
  26. invoice: {
  27. id: '2021-22/51',
  28. date: new Date().toString(),
  29. status: 'over due',
  30. },
  31. client: {
  32. name: 'TechM',
  33. logo: 'https://files.techmahindra.com/static/img/brandkit/logo/Logo-True-Colors-original.png',
  34. project: {
  35. name: 'Telecom Italia',
  36. contract: {
  37. name: 'Phase 1',
  38. amount: '₹ 20,00,000',
  39. },
  40. }
  41. }
  42. }]
  43. const Accounts: React.FC = () => {
  44. const pendingInvoiceForm =
  45. <section className={itemCardStyles.form}>
  46. <div className={itemCardStyles.inputHolder}>
  47. <label> Payment Date </label>
  48. <IonDatetime mode={'ios'} placeholder={'DD/MM/YYYY'} displayFormat={'DD/MM/YYYY'}></IonDatetime>
  49. </div>
  50. <div className={itemCardStyles.inputHolder}>
  51. <label> Reference No. </label>
  52. <IonInput placeholder={'Enter here'}></IonInput>
  53. </div>
  54. <div className={itemCardStyles.buttonsHolder}>
  55. <IonButton fill={'outline'} color="dark" className={itemCardStyles.cancel} shape={'round'}> Cancel Invoice </IonButton>
  56. <IonButton fill={'solid'} className={itemCardStyles.approve + ' ' + itemCardStyles.disabled} shape={'round'}> Paid </IonButton>
  57. </div>
  58. </section>
  59. return (
  60. <IonPage>
  61. <IonContent>
  62. <header className={styles.pageHeader}>
  63. <h4> Accounts </h4>
  64. <button> <CogIcon /> </button>
  65. </header>
  66. <section className={styles.dataBoard}>
  67. <section className={styles.segments}>
  68. <button className={styles.active}> Sep </button>
  69. <button> 1Q </button>
  70. <button> 6M </button>
  71. <button> 1FY </button>
  72. </section>
  73. <ul className={styles.statisticalDetails}>
  74. <li>
  75. <label> <LineChartIcon /> <span> Expenses </span> </label>
  76. <h3> ₹ 5,00,000 </h3>
  77. </li>
  78. <li>
  79. <label> <LineChartIcon /> <span> Income </span> </label>
  80. <h3> ₹ 20,00,000 </h3>
  81. </li>
  82. </ul>
  83. <ul className={styles.quickDraw}>
  84. <li>
  85. <button> </button>
  86. <label> Add Expense </label>
  87. </li>
  88. <li>
  89. <button> </button>
  90. <label> Add Invoice </label>
  91. </li>
  92. <li>
  93. <button> </button>
  94. <label> E-Statement </label>
  95. </li>
  96. <li>
  97. <button> </button>
  98. <label> Reports </label>
  99. </li>
  100. <li>
  101. <button> </button>
  102. <label> Projection </label>
  103. </li>
  104. </ul>
  105. </section>
  106. <div className={styles.dashboardContainer}>
  107. <div className={styles.dashboardContainerSegment}>
  108. <header>
  109. <h5> Pending Invoices </h5>
  110. <a> See All </a>
  111. </header>
  112. {sampleInvoiceData.map((invoice, key) => {
  113. return <ItemCard key={key}
  114. leftImage={invoice.client.logo}
  115. heading={{ name: 'Invoice ID', value: invoice.invoice.id }}
  116. value={invoice.client.project.contract.amount}
  117. description={invoice.client.project.contract.name}
  118. rightText={{
  119. name: invoice.invoice.status,
  120. type: invoice.invoice.status === 'due' ? 'warning' : 'danger'
  121. }}
  122. details={[{
  123. name: 'Invoice ID',
  124. value: invoice.invoice.id,
  125. }, {
  126. name: 'Invoice Date',
  127. value: format(new Date(invoice.invoice.date), 'dd MMMM yyyy')
  128. }, {
  129. name: 'Client',
  130. value: invoice.client.name
  131. }, {
  132. name: 'Project',
  133. value: invoice.client.project.name
  134. }, {
  135. name: 'Contract',
  136. value: invoice.client.project.contract.name
  137. }, {
  138. name: 'Invoice Amount',
  139. value: invoice.client.project.contract.amount
  140. }]}
  141. form={pendingInvoiceForm}
  142. />
  143. })}
  144. </div>
  145. </div>
  146. </IonContent>
  147. </IonPage>
  148. );
  149. };
  150. export default Accounts;