No Description

login.html 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!--
  2. Generated template for the LoginPage page.
  3. See http://ionicframework.com/docs/components/#navigation for more info on
  4. Ionic pages and navigation.
  5. -->
  6. <ion-header>
  7. <ion-navbar color="primary">
  8. <ion-title>My Profile</ion-title>
  9. </ion-navbar>
  10. <ion-toolbar no-border-top *ngIf="isLogin == true">
  11. <ion-segment [(ngModel)]="seg" color='secondary'>
  12. <ion-segment-button value="myinfo">
  13. My Info
  14. </ion-segment-button>
  15. <ion-segment-button value="activities" (ionSelect)="getMyActivities()">
  16. Activities
  17. </ion-segment-button>
  18. <ion-segment-button value="myWallet" (ionSelect)="selectWallet()">
  19. Wallet
  20. </ion-segment-button>
  21. <ion-segment-button value="history">
  22. My Coupons
  23. </ion-segment-button>
  24. </ion-segment>
  25. </ion-toolbar>
  26. </ion-header>
  27. <ion-content>
  28. <ion-refresher (ionRefresh)="refreshSwitch($event)" *ngIf="isLogin">
  29. <ion-refresher-content></ion-refresher-content>
  30. </ion-refresher>
  31. <!--
  32. {{ isLogin }} -->
  33. <div *ngIf="isLogin === false" padding class="forest-bg" style="height:100%">
  34. <ion-grid style="height:100%">
  35. <ion-row justify-content-center align-items-center style="height: 100%">
  36. <ion-col col-12>
  37. <img src="assets/imgs/stravalogo.png" id='stravalogo'>
  38. <button ion-button block (click)="openWeb()" color='yellow-tab' id='login-btn'>
  39. Login With Strava
  40. </button>
  41. </ion-col>
  42. </ion-row>
  43. </ion-grid>
  44. <!--
  45. <a href="http://localhost:8000/strava/">Login Strava</a> -->
  46. </div>
  47. <div *ngIf="isLogin === true" padding-top>
  48. <!--
  49. {{ seg }} -->
  50. <div [ngSwitch]="seg" *ngIf="profileObject">
  51. <div *ngSwitchCase="'myinfo'">
  52. <!--
  53. {{ profileObject | json }} -->
  54. <ion-card>
  55. <div>
  56. <img [src]="profileObject.profile_medium"/>
  57. </div>
  58. <ion-card-content>
  59. <ion-card-title>
  60. {{ profileObject.firstname }} {{ profileObject.lastname }}
  61. </ion-card-title>
  62. <p>
  63. {{ profileObject.city }} {{ profileObject.state }} {{ profileObject.country }}<br>
  64. {{ profileObject.description }}
  65. </p>
  66. <form #f="ngForm" (ngSubmit)="profileSave(f)">
  67. <ion-input placeholder="Enter Your Firstname and Lastname" [(ngModel)]="profile.fullName" required=true name="fullName" #fullName="ngModel"></ion-input>
  68. <ion-label color="danger" *ngIf="fullName.invalid && (fullName.dirty || fullName.touched)">
  69. <div *ngIf="fullName.errors.required">
  70. Name is required.
  71. </div>
  72. </ion-label>
  73. <ion-input placeholder="Enter Email" [(ngModel)]="profile.email" type='email' required name='email' #email="ngModel"></ion-input>
  74. <ion-label color="danger" *ngIf="email.invalid && (email.dirty || email.touched)">
  75. <div *ngIf="email.errors.required">
  76. Email is required.
  77. </div>
  78. </ion-label>
  79. <ion-input placeholder="Enter Tel." [(ngModel)]="profile.tel" required name='tel' #tel="ngModel"></ion-input>
  80. <ion-label color="danger" *ngIf="tel.invalid && (tel.dirty || tel.touched)">
  81. <div *ngIf="tel.errors.required">
  82. Tel. is required.
  83. </div>
  84. </ion-label>
  85. <ion-textarea placeholder="Enter Your Address" [(ngModel)]="profile.address" required name='address' #address="ngModel"></ion-textarea>
  86. <ion-label color="danger" *ngIf="address.invalid && (address.dirty || address.touched)">
  87. <div *ngIf="address.errors.required">
  88. Address is required.
  89. </div>
  90. </ion-label>
  91. <button ion-button color="primary" name='updateProfile' type='submit' block>
  92. <ion-icon name='save'></ion-icon>
  93. Update Profile
  94. </button>
  95. <!--
  96. {{ f.value | json }}
  97. {{ f.valid | json }} -->
  98. </form>
  99. <!--
  100. <dl>
  101. <dt>Email</dt><dd>{{ profileObject.email }}</dd>
  102. <dt>Description</dt><dd>{{ profileObject.description }}</dd>
  103. </dl> -->
  104. </ion-card-content>
  105. <ion-row no-padding>
  106. <ion-col>
  107. <button ion-button color="danger" (click)="logout()" block>
  108. <ion-icon name='log-out'></ion-icon>
  109. Log Out
  110. </button>
  111. </ion-col>
  112. </ion-row>
  113. </ion-card>
  114. </div>
  115. <div *ngSwitchCase="'myWallet'" padding>
  116. <h2 text-center>
  117. <img src='assets/imgs/wallet-solid.png' id="walletIcon"><br>
  118. You have {{ points | number :'1.2-2' }} Points</h2>
  119. <button ion-button block (click)="doRefresh($event)">{{ refreshText }}</button>
  120. </div>
  121. <div *ngSwitchCase="'activities'">
  122. <ion-list>
  123. <ion-item-sliding *ngFor="let a of acts" #slideItem>
  124. <ion-item>
  125. <h2>{{ a.name }}</h2>
  126. <p>{{ a.start_date.$date | date :'short' }} - {{ a.distance.slice(0,-1) / 1000 | number :'1.2-2' }}km</p>
  127. <ion-badge [color]="a.used ? 'light': 'primary'">{{ a.used ? "ใช้ไปแล้ว": "สไลด์ เพื่อแลกแต้ม" }}</ion-badge>
  128. </ion-item>
  129. <ion-item-options *ngIf="!a.used">
  130. <button ion-button color="primary" icon-start (click)="redeem(a, slideItem)">
  131. <ion-icon name="pricetag"></ion-icon>
  132. แลกแต้ม
  133. </button>
  134. <!--
  135. <button ion-button color="primary" icon-start>
  136. <ion-icon name="text"></ion-icon>
  137. Text
  138. </button>
  139. <button ion-button color="secondary" icon-start>
  140. <ion-icon name="call"></ion-icon>
  141. Call
  142. </button> -->
  143. </ion-item-options>
  144. </ion-item-sliding>
  145. </ion-list>
  146. </div>
  147. <div *ngSwitchCase="'history'">
  148. <ion-list>
  149. <h1 *ngIf="!hists || hists.length == 0" text-center>
  150. Please burn and checkout our coupons
  151. </h1>
  152. <ion-item *ngFor="let h of hists" >
  153. <ion-thumbnail item-start>
  154. <img [src]="imageURL + h.p.feature_image">
  155. </ion-thumbnail>
  156. <h2>{{ h.p.name }}</h2>
  157. <p>Cut: {{ h.p.cal_return }}cals</p>
  158. <p>{{ h.created_at.$date | date: 'short' }}</p>
  159. <ion-note item-end *ngIf="!h.t.used">
  160. <button ion-button (click)="openViewCoupon(h)">Use</button>
  161. </ion-note>
  162. </ion-item>
  163. </ion-list>
  164. </div>
  165. </div>
  166. </div>
  167. </ion-content>