ciyidogan commited on
Commit
d155cd0
·
verified ·
1 Parent(s): 693e361

Update flare-ui/src/app/dialogs/project-edit-dialog/project-edit-dialog.component.ts

Browse files
flare-ui/src/app/dialogs/project-edit-dialog/project-edit-dialog.component.ts CHANGED
@@ -1,3 +1,4 @@
 
1
  import { Component, Inject, OnInit } from '@angular/core';
2
  import { CommonModule } from '@angular/common';
3
  import { FormBuilder, FormGroup, Validators, ReactiveFormsModule, FormArray } from '@angular/forms';
@@ -35,7 +36,107 @@ export interface ProjectDialogData {
35
  MatDividerModule,
36
  MatSnackBarModule
37
  ],
38
- templateUrl: './project-edit-dialog.component.html',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  styleUrls: ['./project-edit-dialog.component.scss']
40
  })
41
  export default class ProjectEditDialogComponent implements OnInit {
 
1
+ // project-edit-dialog.component.ts (TÜMÜ) - Template inline olarak
2
  import { Component, Inject, OnInit } from '@angular/core';
3
  import { CommonModule } from '@angular/common';
4
  import { FormBuilder, FormGroup, Validators, ReactiveFormsModule, FormArray } from '@angular/forms';
 
36
  MatDividerModule,
37
  MatSnackBarModule
38
  ],
39
+ template: `
40
+ <h2 mat-dialog-title>{{ data.mode === 'create' ? 'Create New Project' : 'Edit Project' }}</h2>
41
+
42
+ <mat-dialog-content>
43
+ <form [formGroup]="form">
44
+ <mat-form-field appearance="outline" class="full-width">
45
+ <mat-label>Name*</mat-label>
46
+ <input matInput formControlName="name"
47
+ [readonly]="data.mode === 'edit'"
48
+ placeholder="e.g., airline_agent">
49
+ <mat-hint>Use only letters, numbers, and underscores</mat-hint>
50
+ <mat-error *ngIf="form.get('name')?.hasError('required')">Name is required</mat-error>
51
+ <mat-error *ngIf="form.get('name')?.hasError('pattern')">Invalid characters in name</mat-error>
52
+ </mat-form-field>
53
+
54
+ <mat-form-field appearance="outline" class="full-width">
55
+ <mat-label>Caption*</mat-label>
56
+ <input matInput formControlName="caption"
57
+ placeholder="e.g., Airline Customer Service Agent">
58
+ <mat-error *ngIf="form.get('caption')?.hasError('required')">Caption is required</mat-error>
59
+ </mat-form-field>
60
+
61
+ <mat-form-field appearance="outline" class="full-width">
62
+ <mat-label>Icon</mat-label>
63
+ <mat-select formControlName="icon">
64
+ @for (icon of projectIcons; track icon) {
65
+ <mat-option [value]="icon">
66
+ <mat-icon>{{ icon }}</mat-icon>
67
+ {{ icon }}
68
+ </mat-option>
69
+ }
70
+ </mat-select>
71
+ </mat-form-field>
72
+
73
+ <mat-form-field appearance="outline" class="full-width">
74
+ <mat-label>Description</mat-label>
75
+ <textarea matInput formControlName="description" rows="3"></textarea>
76
+ </mat-form-field>
77
+
78
+ <mat-form-field appearance="outline" class="full-width">
79
+ <mat-label>Default Language</mat-label>
80
+ <mat-select formControlName="defaultLanguage">
81
+ @for (lang of languages; track lang.code) {
82
+ <mat-option [value]="lang.code">{{ lang.name }}</mat-option>
83
+ }
84
+ </mat-select>
85
+ </mat-form-field>
86
+
87
+ <mat-form-field appearance="outline" class="full-width">
88
+ <mat-label>Supported Languages</mat-label>
89
+ <mat-select formControlName="supportedLanguages" multiple>
90
+ @for (lang of languages; track lang.code) {
91
+ <mat-option [value]="lang.code">{{ lang.name }}</mat-option>
92
+ }
93
+ </mat-select>
94
+ </mat-form-field>
95
+
96
+ <mat-form-field appearance="outline" class="full-width">
97
+ <mat-label>Timezone</mat-label>
98
+ <mat-select formControlName="timezone">
99
+ @for (tz of timezones; track tz) {
100
+ <mat-option [value]="tz">{{ tz }}</mat-option>
101
+ }
102
+ </mat-select>
103
+ </mat-form-field>
104
+
105
+ <mat-form-field appearance="outline" class="full-width">
106
+ <mat-label>Region</mat-label>
107
+ <input matInput formControlName="region" placeholder="e.g., tr-TR">
108
+ </mat-form-field>
109
+
110
+ <div class="test-users-section">
111
+ <h4>Test Users</h4>
112
+ @for (user of testUsers.controls; track $index) {
113
+ <div class="test-user-row">
114
+ <mat-form-field appearance="outline" class="flex-1">
115
+ <mat-label>Phone Number</mat-label>
116
+ <input matInput [formControl]="user">
117
+ </mat-form-field>
118
+ <button mat-icon-button (click)="removeTestUser($index)">
119
+ <mat-icon>delete</mat-icon>
120
+ </button>
121
+ </div>
122
+ }
123
+ <button mat-stroked-button (click)="addTestUser()">
124
+ <mat-icon>add</mat-icon>
125
+ Add Test User
126
+ </button>
127
+ </div>
128
+ </form>
129
+ </mat-dialog-content>
130
+
131
+ <mat-dialog-actions align="end">
132
+ <button mat-button (click)="close()">Cancel</button>
133
+ <button mat-raised-button color="primary"
134
+ (click)="save()"
135
+ [disabled]="form.invalid || saving">
136
+ {{ saving ? 'Saving...' : (data.mode === 'create' ? 'Create' : 'Save') }}
137
+ </button>
138
+ </mat-dialog-actions>
139
+ `,
140
  styleUrls: ['./project-edit-dialog.component.scss']
141
  })
142
  export default class ProjectEditDialogComponent implements OnInit {