Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/GarantPlatformFrontend/main.c6c9dc5beb0d7ffee412.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DealLandingModule } from './modules/landing/deal-landing/deal-landing.c
import { ConfiguratorAuthModule } from './modules/configurator/configurator-auth/configurator-auth.component';
import { ConfiguratorAdminModule } from './modules/configurator/configurator-admin/configurator-admin.component';
import { NotificationsModule } from './modules/profile/profile-requests/notifications.component';
import { MyDealsModule } from './modules/profile/profile-my-deals/profile-my-deals.component';

const routes: Routes = [
{
Expand Down Expand Up @@ -161,6 +162,11 @@ const routes: Routes = [
{
path: "configurator/admin",
component: ConfiguratorAdminModule
},

{
path: "profile/deals",
component: MyDealsModule
}
];

Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { NotificationsModule } from "./modules/profile/profile-requests/notifica
import { ConfiguratorAuthModule } from "./modules/configurator/configurator-auth/configurator-auth.component";
import { TabMenuModule } from 'primeng/tabmenu';
import { ConfiguratorAdminModule } from "./modules/configurator/configurator-admin/configurator-admin.component";
import { MyDealsModule } from "./modules/profile/profile-my-deals/profile-my-deals.component";


@NgModule({
Expand Down Expand Up @@ -102,7 +103,8 @@ import { ConfiguratorAdminModule } from "./modules/configurator/configurator-adm
DealLandingModule,
NotificationsModule,
ConfiguratorAuthModule,
ConfiguratorAdminModule
ConfiguratorAdminModule,
MyDealsModule
],

entryComponents: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ <h5 class="consulting">Оставьте заявку</h5>
</div>

<div class="block-two">
<button class="control-button-blue" (click)="onEditBusinessAsync()">Приобрести бизнес онлайн</button>
<button routerLink="/deal/start" class="control-button-blue">Приобрести бизнес онлайн</button>
</div>
</div>
<!-- </div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,29 +401,77 @@ export class ViewReadyBusinessModule implements OnInit {
* @returns Данные заявки.
*/
public async onCreateRequestBusinessAsync(userName: string, number: string, businessId: number) {
try {
console.log("onCreateRequestBusinessAsync");
let requestBusinessInput = new RequestBusinessInput();

if (userName == "" || number == "" || businessId <= 0) {
return;
}

requestBusinessInput.UserName = userName;
requestBusinessInput.Phone = number;
requestBusinessInput.BusinessId = businessId;
// try {
// console.log("onCreateRequestBusinessAsync");
// let requestBusinessInput = new RequestBusinessInput();

// if (userName == "" || number == "" || businessId <= 0) {
// return;
// }

// requestBusinessInput.UserName = userName;
// requestBusinessInput.Phone = number;
// requestBusinessInput.BusinessId = businessId;

// new Promise(function(resolve, reject) {

// setTimeout(async() => {
// await this.checkUserPassportDataAsync();
// console.log("result",result);
// }, 1000); // (*)

// }).then(async(result) =>{ // (**)

// await this.checkUserPassportDataAsync();
// console.log("result",result);

// }).then(async(result) => { // (***)

// await this.http.post(API_URL.apiUrl.concat("/request/create-request-business"), requestBusinessInput)
// .subscribe({
// next: (response: any) => {
// console.log("Заявка успешно создана", response);

// if (response.isSuccessCreatedRequest) {
// this.messageService.add({
// severity: 'success',
// summary: 'Успешно!',
// detail: response.statusText
// });
// }
// },

// error: (err) => {
// throw new Error(err);
// }
// });
// });
// }

// catch (e: any) {
// throw new Error(e);
// }
};

await this.http.post(API_URL.apiUrl.concat("/request/create-request-business"), requestBusinessInput)
/**
* Функция проверит заполненность паспортных данных пользователя.
* @returns - Статус проверки.
*/
private async checkUserPassportDataAsync() {
try {
await this.http.get(API_URL.apiUrl.concat("/user/check-user-passport-data"))
.subscribe({
next: (response: any) => {
console.log("Заявка успешно создана", response);
console.log("check passport data: ", response);

if (response.isSuccessCreatedRequest) {
if (!response) {
this.messageService.add({
severity: 'success',
summary: 'Успешно!',
detail: response.statusText
severity: 'warn',
summary: 'Внимание',
detail: 'Вы не заполнили свои паспортные данные. Они обязательны для сделки через Гарант.'
});

return;
}
},

Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
</a>
</li>

<li>
<a class="text-center" routerLink="/">
<li routerLink="/profile/deals">
<a class="text-center">
<svg width="34" height="32" viewBox="0 0 42 43" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#a)">
<path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ <h3 class="profile-subtitle">Паспортные данные</h3>
</p-tabPanel>

<p-tabPanel header="Юридическое лицо">
Пока не продумано
В процессе разработки
</p-tabPanel>

<p-tabPanel header="Индивидуальный предприниматель">
Пока не продумано
В процессе разработки
</p-tabPanel>
</p-tabView>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use "./../manage-account/manage-account.component.scss";
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<div class="row">
<div class="col-lg-3">
<manage-account></manage-account>
</div>

<div class="col-lg-9">
<h2 class="profile-title">Мои сделки</h2>

<div class="mt-3">
<div class="card">
<p-tabView>
<p-tabPanel header="Активные">
<div *ngFor="let item of aDeals">
<p-card [style]="{width: '360px'}" styleClass="p-card-shadow">
<ng-template pTemplate="header">
<img [src]="item.itemDealUrl">
</ng-template>

<div>
{{item.dealItemTitle}}
</div>

<div>
{{item.statusTitle}} {{item.statusText}}
</div>

<div>
{{item.middleText}} {{item.currentUserName}} {{item.ownerDeaItemUserName}}
</div>

<ng-template pTemplate="footer">
<button pButton pRipple type="button"
[label]="item.buttonActionText"
class="p-button-info"
(click)="onRouteDealAsync(item.itemId, item.type)"></button>
</ng-template>
</p-card>
</div>
</p-tabPanel>

<p-tabPanel header="Завершенные">

</p-tabPanel>

<p-tabPanel header="Не состоявшиеся">

</p-tabPanel>
</p-tabView>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use "./../manage-account/manage-account.component.scss";
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { Component, OnInit } from "@angular/core";
import { Title } from "@angular/platform-browser";
import { HttpClient } from "@angular/common/http";
import { API_URL } from "src/app/core/core-urls/api-url";
import { ConfirmationService, MessageService } from "primeng/api";
import { CommonDataService } from "src/app/services/common/common-data.service";
import { Router } from "@angular/router";

@Component({
selector: "profile-my-deals",
templateUrl: "./profile-my-deals.component.html",
styleUrls: ["./profile-my-deals.component.scss"],
providers: [ConfirmationService, MessageService]
})

/**
* Класс модуля мои сделки.
*/
export class MyDealsModule implements OnInit {
aDeals: any[] = [];

constructor(private titleService: Title,
private http: HttpClient,
private commonService: CommonDataService,
private router: Router) {

};

public async ngOnInit() {
// TODO: переделать на получение заголовка с бэка.
this.titleService.setTitle("Gobizy: Мои сделки");
await this.getDealsRequestsAsync();
};

/**
* Функция получит список заявок.
*/
private async getDealsRequestsAsync() {
try {
await this.http.post(API_URL.apiUrl.concat("/request/get-deals"), {})
.subscribe({
next: (response: any) => {
console.log("Список сделок по заявкам: ", response);
this.aDeals = response;
},

error: (err) => {
this.commonService.routeToStart(err);
throw new Error(err);
}
});
}

catch (e: any) {
throw new Error(e);
}
};

/**
* Функция перейдет в Гарант, если заявка подтверждена.
*/
public async onRouteDealAsync(requestId: number, type: string) {
try {
await this.http.get(API_URL.apiUrl.concat("/request/check-confirm-request?requestId=" + requestId + "&type=" + type))
.subscribe({
next: (response: any) => {
console.log("Статус заявки: ", response);

if (type == "Business") {
this.router.navigate(["/garant/garant-init"], {
queryParams: {
businessId: requestId,
stage: 1
}
});
}

if (type == "Franchise") {
this.router.navigate(["/garant/garant-init"], {
queryParams: {
franchiseId: requestId,
stage: 1
}
});
}
},

error: (err) => {
this.commonService.routeToStart(err);
throw new Error(err);
}
});
}

catch (e: any) {
throw new Error(e);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class NotificationsModule implements OnInit {
console.log("onGetBusinessRequestsAsync");

try {
await this.http.get(API_URL.apiUrl.concat("/request/get-requests"))
await this.http.post(API_URL.apiUrl.concat("/request/get-requests"), {})
.subscribe({
next: (response: any) => {
console.log("Список заявок: ", response);
Expand Down