refactor: reformat(prettier)
This commit is contained in:
@@ -4,8 +4,5 @@ import { provideRouter } from '@angular/router';
|
|||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [provideBrowserGlobalErrorListeners(), provideRouter(routes)],
|
||||||
provideBrowserGlobalErrorListeners(),
|
|
||||||
provideRouter(routes)
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ export const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: TaskList,
|
component: TaskList,
|
||||||
title: 'Главная страница'
|
title: 'Главная страница',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'details/:id',
|
path: 'details/:id',
|
||||||
component: TaskDetails,
|
component: TaskDetails,
|
||||||
title: 'Подробно'
|
title: 'Подробно',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'new',
|
path: 'new',
|
||||||
component: TaskNew,
|
component: TaskNew,
|
||||||
title: 'Новая'
|
title: 'Новая',
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { lucideCircleX, lucideSquarePlus } from '@ng-icons/lucide';
|
|||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<input [(ngModel)]="filterInput" type="text" placeholder="Поиск по задачам" />
|
<input [(ngModel)]="filterInput" type="text" placeholder="Поиск по задачам" />
|
||||||
<button (click)="filterInput.set('')">
|
<button (click)="filterInput.set('')">
|
||||||
<ng-icon name="lucideCircleX" size="20" strokeWidth="1.5"/>
|
<ng-icon name="lucideCircleX" size="20" strokeWidth="1.5" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<a routerLink="/new">
|
<a routerLink="/new">
|
||||||
@@ -64,7 +64,7 @@ import { lucideCircleX, lucideSquarePlus } from '@ng-icons/lucide';
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-left: .5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,32 +5,30 @@ import { Router } from '@angular/router';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ksk-crm-task-new',
|
selector: 'ksk-crm-task-new',
|
||||||
imports: [
|
imports: [ReactiveFormsModule],
|
||||||
ReactiveFormsModule
|
|
||||||
],
|
|
||||||
template: `
|
template: `
|
||||||
<form [formGroup]="formGroup" (submit)="submitForm()">
|
<form [formGroup]="formGroup" (submit)="submitForm()">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="name">Имя: </label>
|
<label for="name">Имя: </label>
|
||||||
<input id="name" type="text" formControlName="name">
|
<input id="name" type="text" formControlName="name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="city">Город: </label>
|
<label for="city">Город: </label>
|
||||||
<input id="city" type="text" formControlName="city">
|
<input id="city" type="text" formControlName="city" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="streetAddress">Адрес: </label>
|
<label for="streetAddress">Адрес: </label>
|
||||||
<input id="streetAddress" type="text" formControlName="streetAddress">
|
<input id="streetAddress" type="text" formControlName="streetAddress" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="numberPhone">Номер телефона: </label>
|
<label for="numberPhone">Номер телефона: </label>
|
||||||
<input id="numberPhone" type="text" formControlName="numberPhone">
|
<input id="numberPhone" type="text" formControlName="numberPhone" />
|
||||||
</div>
|
</div>
|
||||||
<button type="submit">Добавить</button>
|
<button type="submit">Добавить</button>
|
||||||
</form>
|
</form>
|
||||||
`,
|
`,
|
||||||
styles: `
|
styles: `
|
||||||
form{
|
form {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -38,7 +36,7 @@ import { Router } from '@angular/router';
|
|||||||
.form-field {
|
.form-field {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
button{
|
button {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -52,15 +50,15 @@ export class TaskNew {
|
|||||||
city: new FormControl(''),
|
city: new FormControl(''),
|
||||||
streetAddress: new FormControl(''),
|
streetAddress: new FormControl(''),
|
||||||
numberPhone: new FormControl(''),
|
numberPhone: new FormControl(''),
|
||||||
})
|
});
|
||||||
|
|
||||||
async submitForm(){
|
async submitForm() {
|
||||||
const createdTask = await this.taskService.createTask({
|
const createdTask = await this.taskService.createTask({
|
||||||
name: this.formGroup.value.name ?? "",
|
name: this.formGroup.value.name ?? '',
|
||||||
city: this.formGroup.value.city ?? "",
|
city: this.formGroup.value.city ?? '',
|
||||||
streetAddress: this.formGroup.value.streetAddress ?? "",
|
streetAddress: this.formGroup.value.streetAddress ?? '',
|
||||||
numberPhone: this.formGroup.value.numberPhone ?? "",
|
numberPhone: this.formGroup.value.numberPhone ?? '',
|
||||||
})
|
});
|
||||||
|
|
||||||
this.formGroup.reset();
|
this.formGroup.reset();
|
||||||
await this.router.navigate(['details', createdTask.id]);
|
await this.router.navigate(['details', createdTask.id]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Service } from '@angular/core';
|
import { Service } from '@angular/core';
|
||||||
import { Task } from './task';
|
import { Task } from './task';
|
||||||
import PocketBase from 'pocketbase'
|
import PocketBase from 'pocketbase';
|
||||||
import { environment } from '../../../environments/environment'
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class TaskService {
|
export class TaskService {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
apiUrl: "http://10.1.1.40:8090",
|
apiUrl: 'http://10.1.1.40:8090',
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -9,6 +9,6 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<ksk-crm-root></ksk-crm-root>
|
<ksk-crm-root></ksk-crm-root>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1
-2
@@ -2,5 +2,4 @@ import { bootstrapApplication } from '@angular/platform-browser';
|
|||||||
import { appConfig } from './app/app.config';
|
import { appConfig } from './app/app.config';
|
||||||
import { App } from './app/app';
|
import { App } from './app/app';
|
||||||
|
|
||||||
bootstrapApplication(App, appConfig)
|
bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
||||||
.catch((err) => console.error(err));
|
|
||||||
|
|||||||
Reference in New Issue
Block a user