UNPKG

5.18 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var core_1 = require("@angular/core");
4var forms_1 = require("@angular/forms");
5var Observable_1 = require("rxjs/Observable");
6var material_1 = require("@angular/material");
7var BehaviorSubject_1 = require("rxjs/BehaviorSubject");
8var ResetPasswordRequestComponent = /** @class */ (function () {
9 function ResetPasswordRequestComponent(snackBar) {
10 this.snackBar = snackBar;
11 this.submitted = new core_1.EventEmitter();
12 this.maximumResendingHappend$ = new BehaviorSubject_1.BehaviorSubject(false);
13 this.timer$ = Observable_1.Observable.timer(0, 100)
14 .map(function (i) { return i + 1; })
15 .takeWhile(function (i) { return i * 100 <= 3000; })
16 .map(function (i) { return 3000 - i * 100; });
17 }
18 Object.defineProperty(ResetPasswordRequestComponent.prototype, "pending", {
19 set: function (isPending) {
20 if (isPending) {
21 this.formGroup.disable();
22 }
23 this.formGroup.enable();
24 },
25 enumerable: true,
26 configurable: true
27 });
28 ResetPasswordRequestComponent.prototype.ngOnInit = function () {
29 var _this = this;
30 this.numberOfRequested.subscribe(function (data) {
31 if (data > 2) {
32 _this.maximumResendingHappend$.next(true);
33 }
34 });
35 };
36 ResetPasswordRequestComponent.prototype.submit = function () {
37 if (this.formGroup.valid) {
38 this.submitted.emit(this.formGroup.value);
39 var message = (this.maximumResendingHappend$.getValue())
40 ? 'عدم امکان ...'
41 : 'پیامک جدید برای شما ارسال گردید.';
42 this.snackBar.open(message, '', {
43 duration: 3000,
44 });
45 }
46 };
47 ResetPasswordRequestComponent.decorators = [
48 { type: core_1.Component, args: [{
49 selector: 'user-reset-password-request',
50 template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"submit()\" fxLayout=\"column\"> <mat-card> <mat-card-header> <mat-card-title> <h3>\u062F\u0631\u062E\u0648\u0627\u0633\u062A \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631</h3> </mat-card-title> </mat-card-header> <mat-card-content> <p>\u0628\u0631\u0627\u06CC \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631 \u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u062E\u0648\u062F \u0631\u0627 \u0648\u0627\u0631\u062F \u0646\u0645\u0627\u06CC\u06CC\u062F</p> <mat-radio-group fxFlexFill formControlName=\"Type\"> <mat-radio-button value=\"sms\">\u067E\u06CC\u0627\u0645\u06A9</mat-radio-button> <mat-radio-button value=\"email\">\u067E\u0633\u062A \u0627\u0644\u06A9\u062A\u0631\u0648\u0646\u06CC\u06A9\u06CC</mat-radio-button> </mat-radio-group> <mat-form-field fxFlexFill> <input matInput placeholder=\"\u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647\" formControlName=\"Username\"> </mat-form-field> </mat-card-content> <mat-card-actions> <!--<button type=\"submit\" [disabled]='(canRequestPin | async) || (maximumResendingHappend$ | async)' (click)=\"submit()\" mat-raised-button color=\"primary\">--> <button type=\"submit\" [disabled]='(canRequestPin | async)' (click)=\"submit()\" mat-raised-button color=\"primary\"> <span *ngIf='!(canRequestPin | async)'> \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631 </span> <!--<div *ngIf='(canRequestPin | async) && !(maximumResendingHappend$ | async)'> {{timer$ | async}} \u062B\u0627\u0646\u06CC\u0647 \u062A\u0627 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631 \u062E\u0648\u0627\u0633\u062A \u062F\u0648\u0628\u0627\u0631\u0647 \u062F\u0631\u06CC\u0627\u0641\u062A \u067E\u06CC\u0627\u0645\u06A9. </div> <div *ngIf='(maximumResendingHappend$ | async)'> \u0639\u062F\u0645 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631\u062E\u0648\u0627\u0633\u062A </div>--> </button> <a mat-button routerLink='/auth/signin'>\u0627\u0646\u0635\u0631\u0627\u0641</a> </mat-card-actions> </mat-card> </form>",
51 styles: [""]
52 },] },
53 ];
54 /** @nocollapse */
55 ResetPasswordRequestComponent.ctorParameters = function () { return [
56 { type: material_1.MatSnackBar, },
57 ]; };
58 ResetPasswordRequestComponent.propDecorators = {
59 "submitted": [{ type: core_1.Output },],
60 "formGroup": [{ type: core_1.Input },],
61 "numberOfRequested": [{ type: core_1.Input },],
62 "canRequestPin": [{ type: core_1.Input },],
63 "pending": [{ type: core_1.Input },],
64 };
65 return ResetPasswordRequestComponent;
66}());
67exports.ResetPasswordRequestComponent = ResetPasswordRequestComponent;
68//# sourceMappingURL=reset-password-request.component.js.map
\No newline at end of file