This repository has been archived by the owner on Jun 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from deissh/dev
Dev
- Loading branch information
Showing
39 changed files
with
1,402 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
|
||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { ReportPage } from 'src/app/modal/report/report.page'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
IonicModule, | ||
], | ||
declarations: [ReportPage], | ||
entryComponents: [ReportPage] | ||
}) | ||
export class ReportPageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-button (click)="close()"> | ||
<ion-icon slot="icon-only" name="close"></ion-icon> | ||
</ion-button> | ||
</ion-buttons> | ||
<ion-title>Создание репорта</ion-title> | ||
<ion-buttons slot="end"> | ||
<ion-button (click)="report()"> | ||
Отправить | ||
</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content fullpage> | ||
<ion-item> | ||
<ion-label position="stacked">Название</ion-label> | ||
<ion-input minlength="8" [(ngModel)]="name" required></ion-input> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label position="stacked"> | ||
Описание проблемы | ||
</ion-label> | ||
<ion-textarea | ||
minlength="10" | ||
[(ngModel)]="body" | ||
placeholder="Подробно опишите вашу проблему" | ||
style="height: 250px;" | ||
> | ||
</ion-textarea> | ||
</ion-item> | ||
</ion-content> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ReportPage } from './report.page'; | ||
|
||
describe('ReportPage', () => { | ||
let component: ReportPage; | ||
let fixture: ComponentFixture<ReportPage>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ReportPage ], | ||
schemas: [CUSTOM_ELEMENTS_SCHEMA], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ReportPage); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
import { Storage } from '@ionic/storage'; | ||
import { ToastController, ModalController } from '@ionic/angular'; | ||
import { ReportService } from 'src/app/providers/report.service'; | ||
import { Firebase } from '@ionic-native/firebase/ngx'; | ||
import { Form } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-report', | ||
templateUrl: './report.page.html', | ||
styleUrls: ['./report.page.scss'], | ||
}) | ||
export class ReportPage implements OnInit { | ||
// привязка к посту, пользователю | ||
@Input() public post_id?: string; | ||
@Input() public user_id?: string; | ||
|
||
public name: string; | ||
public body: string; | ||
|
||
public reportForm: Form; | ||
|
||
constructor( | ||
private modalController: ModalController, | ||
private storage: Storage, | ||
private toast: ToastController, | ||
private rep: ReportService, | ||
private firebase: Firebase | ||
) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
public async close() { | ||
await this.modalController.dismiss({ action: 'closed' }); | ||
} | ||
|
||
public async report() { | ||
const user_local = await this.storage.get('user_local'); | ||
try { | ||
await this.rep.send({ | ||
name: this.name, | ||
body: this.body, | ||
post_id: this.post_id, | ||
user_id: this.user_id, | ||
authod_id: user_local.id || '' | ||
}); | ||
|
||
(await this.toast.create({ | ||
message: 'Спасибо за репорт!', | ||
duration: 5000 | ||
})).present(); | ||
this.modalController.dismiss({ action: 'sended' }); | ||
} catch (e) { | ||
// логируем в консоль браузера | ||
console.error(e); | ||
// логируем в фаербейс | ||
await this.firebase.logError(e); | ||
(await this.toast.create({ | ||
message: 'Ошибка при отправке, попробуйте чуть позже', | ||
duration: 5000 | ||
})).present(); | ||
} | ||
} | ||
} |
Oops, something went wrong.