create-new.template.ts
· 6.4 KiB · TypeScript
Raw
import { Component, DestroyRef, inject, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatOptionModule } from '@angular/material/core';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { LoadingService } from 'src/services/loading.service';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { HttpClientModule } from '@angular/common/http';
import { MatCardModule } from '@angular/material/card';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatRadioModule } from '@angular/material/radio';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDividerModule } from '@angular/material/divider';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { scaleIn400ms } from '@vex/animations/scale-in.animation';
import { fadeInRight400ms } from '@vex/animations/fade-in-right.animation';
import { UploaderComponent } from 'src/app/components/uploader/uploader.component';
import { MatSliderModule } from '@angular/material/slider';
import { SelectLanguageComponent } from 'src/app/components/select/select-language/select-language.component';
import { HeaderComponent } from '../../components/header/header.component';
import { HeaderData } from '../../components/header/header.model';
import { ProjectDetailsComponent } from "../../components/project-details/project-details.component";
import { ProjectNotesComponent } from "../../components/project-notes/project-notes.component";
import { moreInfoService } from '../../components/more-info.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ApiService } from 'src/services/api.service';
import { ConfirmDialogComponent } from 'src/app/components/ui/confirm-dialog/confirm-dialog.component';
import { SelectVoiceComponent } from "src/app/components/select/select-voice/select-voice.component";
import { MatMenuModule } from '@angular/material/menu';
import { RenameDialogComponent } from 'src/app/components/ui/rename-dialog/rename-dialog.component';
import { ProjectDetailsForm, voiceFormGlobal } from 'src/models/global.model';
import { SecurityService } from 'src/services/security/security.service';
import { ManageUsersDialogComponent } from '../../video/lumo/manage-users-dialog/manage-users-dialog.component';
import { ServicesService } from 'src/services/services.service';
@Component({
selector: 'vex-lumo',
standalone: true,
imports: [
FormsModule,
MatButtonModule,
MatButtonToggleModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatOptionModule,
MatSnackBarModule,
MatCardModule,
MatIconModule,
MatProgressBarModule,
MatDividerModule,
HttpClientModule,
TranslateModule,
MatMenuModule,
MatRadioModule,
MatIconModule,
MatCheckboxModule,
MatSlideToggleModule,
MatTooltipModule,
MatDialogModule,
MatExpansionModule,
MatSliderModule,
HeaderComponent,
ProjectDetailsComponent,
ProjectNotesComponent,
SelectLanguageComponent,
UploaderComponent,
SelectVoiceComponent
],
animations: [
scaleIn400ms,
fadeInRight400ms
],
templateUrl: './podcast.component.html',
styleUrls: ['./podcast.component.scss']
})
export class PodcastComponent implements OnInit {
private readonly destroyRef: DestroyRef = inject(DestroyRef);
// PAGE DETAILS
currService = this.servicesService.services.find(service => service.label === 'Podcast');
headerData: HeaderData = {
title: this.currService.label,
icon: this.currService.icon_2,
projectType: this.currService.type,
crumbs: [{ link: '/create', title: 'Create' }, { link: this.currService.createUrl, title: this.currService.label }]
};
// PROJECT PROPERTIES
// UI PROPERTIES
showErrorsCtrl = new FormControl(false);
isTouched = false;
// PROJECT FORM
mainForm: FormGroup = new FormGroup({
projectDetails: new FormGroup<ProjectDetailsForm>({
projectName: new FormControl('', [Validators.required]),
startLanguage: new FormControl(''),
projectOwner: new FormControl(null, []),
projectManager: new FormControl(null, []),
setDates: new FormControl(false, []),
startDate: new FormControl(new Date(), []),
endDate: new FormControl(null, []),
endTime: new FormControl('12:00', []),
projectNotes: new FormControl('', []),
internalID: new FormControl(null, []),
targetLanguages: new FormControl([]),
}),
projectSettings: new FormGroup({
}),
});
constructor(
protected loadingService: LoadingService,
protected moreInfoService: moreInfoService,
public translate: TranslateService,
private route: ActivatedRoute,
private apiService: ApiService,
private dialog: MatDialog,
private snackbar: MatSnackBar,
private fb: FormBuilder,
private router: Router,
private securityService: SecurityService,
private servicesService: ServicesService
) { }
ngOnInit(): void {
this.route.queryParams.subscribe(params => {
this.projectNameCtrl.setValue(params['projectName']);
});
// INITIALIZATIONS
// SUBSCRIPTIONS
}
// FUNCTIONS
// FUNCTIONS
// FUNCTIONS
// OTHER
// OTHER
// OTHER
// SUBMIT
// SUBMIT
// SUBMIT
formSubmit() {
}
// UI SECTION
// UI SECTION
// UI SECTION
// GETTERS
// Form Groups
get projectDetailsGroup() {
return this.mainForm.get('projectDetails') as FormGroup;
}
// Form Controls
get projectNameCtrl() {
return this.projectDetailsGroup.get('projectName') as FormControl;
}
}
| 1 | import { Component, DestroyRef, inject, OnInit } from '@angular/core'; |
| 2 | import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; |
| 3 | import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; |
| 4 | import { MatCheckboxModule } from '@angular/material/checkbox'; |
| 5 | import { MatOptionModule } from '@angular/material/core'; |
| 6 | import { MatSelectModule } from '@angular/material/select'; |
| 7 | import { MatInputModule } from '@angular/material/input'; |
| 8 | import { MatFormFieldModule } from '@angular/material/form-field'; |
| 9 | import { MatIconModule } from '@angular/material/icon'; |
| 10 | import { MatButtonModule } from '@angular/material/button'; |
| 11 | import { LoadingService } from 'src/services/loading.service'; |
| 12 | import { ActivatedRoute, Router } from '@angular/router'; |
| 13 | import { TranslateModule, TranslateService } from '@ngx-translate/core'; |
| 14 | import { MatAutocompleteModule } from '@angular/material/autocomplete'; |
| 15 | import { HttpClientModule } from '@angular/common/http'; |
| 16 | import { MatCardModule } from '@angular/material/card'; |
| 17 | import { MatProgressBarModule } from '@angular/material/progress-bar'; |
| 18 | import { MatRadioModule } from '@angular/material/radio'; |
| 19 | import { MatSlideToggleModule } from '@angular/material/slide-toggle'; |
| 20 | import { MatTooltipModule } from '@angular/material/tooltip'; |
| 21 | import { MatDialog, MatDialogModule } from '@angular/material/dialog'; |
| 22 | import { MatExpansionModule } from '@angular/material/expansion'; |
| 23 | import { MatDatepickerModule } from '@angular/material/datepicker'; |
| 24 | import { MatDividerModule } from '@angular/material/divider'; |
| 25 | import { MatButtonToggleModule } from '@angular/material/button-toggle'; |
| 26 | import { scaleIn400ms } from '@vex/animations/scale-in.animation'; |
| 27 | import { fadeInRight400ms } from '@vex/animations/fade-in-right.animation'; |
| 28 | import { UploaderComponent } from 'src/app/components/uploader/uploader.component'; |
| 29 | import { MatSliderModule } from '@angular/material/slider'; |
| 30 | import { SelectLanguageComponent } from 'src/app/components/select/select-language/select-language.component'; |
| 31 | import { HeaderComponent } from '../../components/header/header.component'; |
| 32 | import { HeaderData } from '../../components/header/header.model'; |
| 33 | import { ProjectDetailsComponent } from "../../components/project-details/project-details.component"; |
| 34 | import { ProjectNotesComponent } from "../../components/project-notes/project-notes.component"; |
| 35 | import { moreInfoService } from '../../components/more-info.service'; |
| 36 | import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
| 37 | import { ApiService } from 'src/services/api.service'; |
| 38 | import { ConfirmDialogComponent } from 'src/app/components/ui/confirm-dialog/confirm-dialog.component'; |
| 39 | import { SelectVoiceComponent } from "src/app/components/select/select-voice/select-voice.component"; |
| 40 | import { MatMenuModule } from '@angular/material/menu'; |
| 41 | import { RenameDialogComponent } from 'src/app/components/ui/rename-dialog/rename-dialog.component'; |
| 42 | import { ProjectDetailsForm, voiceFormGlobal } from 'src/models/global.model'; |
| 43 | import { SecurityService } from 'src/services/security/security.service'; |
| 44 | import { ManageUsersDialogComponent } from '../../video/lumo/manage-users-dialog/manage-users-dialog.component'; |
| 45 | import { ServicesService } from 'src/services/services.service'; |
| 46 | |
| 47 | @Component({ |
| 48 | selector: 'vex-lumo', |
| 49 | standalone: true, |
| 50 | imports: [ |
| 51 | FormsModule, |
| 52 | MatButtonModule, |
| 53 | MatButtonToggleModule, |
| 54 | ReactiveFormsModule, |
| 55 | MatFormFieldModule, |
| 56 | MatInputModule, |
| 57 | MatSelectModule, |
| 58 | MatOptionModule, |
| 59 | MatSnackBarModule, |
| 60 | MatCardModule, |
| 61 | MatIconModule, |
| 62 | MatProgressBarModule, |
| 63 | MatDividerModule, |
| 64 | HttpClientModule, |
| 65 | TranslateModule, |
| 66 | MatMenuModule, |
| 67 | MatRadioModule, |
| 68 | MatIconModule, |
| 69 | MatCheckboxModule, |
| 70 | MatSlideToggleModule, |
| 71 | MatTooltipModule, |
| 72 | MatDialogModule, |
| 73 | MatExpansionModule, |
| 74 | MatSliderModule, |
| 75 | HeaderComponent, |
| 76 | ProjectDetailsComponent, |
| 77 | ProjectNotesComponent, |
| 78 | SelectLanguageComponent, |
| 79 | UploaderComponent, |
| 80 | SelectVoiceComponent |
| 81 | ], |
| 82 | animations: [ |
| 83 | scaleIn400ms, |
| 84 | fadeInRight400ms |
| 85 | ], |
| 86 | templateUrl: './podcast.component.html', |
| 87 | styleUrls: ['./podcast.component.scss'] |
| 88 | }) |
| 89 | export class PodcastComponent implements OnInit { |
| 90 | private readonly destroyRef: DestroyRef = inject(DestroyRef); |
| 91 | |
| 92 | // PAGE DETAILS |
| 93 | currService = this.servicesService.services.find(service => service.label === 'Podcast'); |
| 94 | headerData: HeaderData = { |
| 95 | title: this.currService.label, |
| 96 | icon: this.currService.icon_2, |
| 97 | projectType: this.currService.type, |
| 98 | crumbs: [{ link: '/create', title: 'Create' }, { link: this.currService.createUrl, title: this.currService.label }] |
| 99 | }; |
| 100 | |
| 101 | // PROJECT PROPERTIES |
| 102 | // UI PROPERTIES |
| 103 | showErrorsCtrl = new FormControl(false); |
| 104 | isTouched = false; |
| 105 | |
| 106 | // PROJECT FORM |
| 107 | mainForm: FormGroup = new FormGroup({ |
| 108 | projectDetails: new FormGroup<ProjectDetailsForm>({ |
| 109 | projectName: new FormControl('', [Validators.required]), |
| 110 | startLanguage: new FormControl(''), |
| 111 | projectOwner: new FormControl(null, []), |
| 112 | projectManager: new FormControl(null, []), |
| 113 | setDates: new FormControl(false, []), |
| 114 | startDate: new FormControl(new Date(), []), |
| 115 | endDate: new FormControl(null, []), |
| 116 | endTime: new FormControl('12:00', []), |
| 117 | projectNotes: new FormControl('', []), |
| 118 | internalID: new FormControl(null, []), |
| 119 | targetLanguages: new FormControl([]), |
| 120 | }), |
| 121 | projectSettings: new FormGroup({ |
| 122 | }), |
| 123 | }); |
| 124 | |
| 125 | constructor( |
| 126 | protected loadingService: LoadingService, |
| 127 | protected moreInfoService: moreInfoService, |
| 128 | public translate: TranslateService, |
| 129 | private route: ActivatedRoute, |
| 130 | private apiService: ApiService, |
| 131 | private dialog: MatDialog, |
| 132 | private snackbar: MatSnackBar, |
| 133 | private fb: FormBuilder, |
| 134 | private router: Router, |
| 135 | private securityService: SecurityService, |
| 136 | private servicesService: ServicesService |
| 137 | ) { } |
| 138 | |
| 139 | ngOnInit(): void { |
| 140 | this.route.queryParams.subscribe(params => { |
| 141 | this.projectNameCtrl.setValue(params['projectName']); |
| 142 | }); |
| 143 | |
| 144 | // INITIALIZATIONS |
| 145 | |
| 146 | // SUBSCRIPTIONS |
| 147 | } |
| 148 | |
| 149 | // FUNCTIONS |
| 150 | // FUNCTIONS |
| 151 | // FUNCTIONS |
| 152 | |
| 153 | // OTHER |
| 154 | // OTHER |
| 155 | // OTHER |
| 156 | |
| 157 | |
| 158 | // SUBMIT |
| 159 | // SUBMIT |
| 160 | // SUBMIT |
| 161 | formSubmit() { |
| 162 | } |
| 163 | |
| 164 | // UI SECTION |
| 165 | // UI SECTION |
| 166 | // UI SECTION |
| 167 | |
| 168 | // GETTERS |
| 169 | // Form Groups |
| 170 | get projectDetailsGroup() { |
| 171 | return this.mainForm.get('projectDetails') as FormGroup; |
| 172 | } |
| 173 | |
| 174 | // Form Controls |
| 175 | get projectNameCtrl() { |
| 176 | return this.projectDetailsGroup.get('projectName') as FormControl; |
| 177 | } |
| 178 | |
| 179 | } |