All changes i made

This commit is contained in:
Eudes Inácio
2023-02-27 09:34:36 +01:00
77 changed files with 8025 additions and 6717 deletions
@@ -96,7 +96,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-textarea-class flex-grow-1">
<ion-textarea [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
<ion-textarea [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção*"></ion-textarea>
</div>
</div>
</div>
@@ -5,6 +5,7 @@ import * as moment from 'moment';
import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-edit-action',
@@ -41,6 +42,7 @@ export class EditActionPage implements OnInit {
private toastService: ToastService,
private navParams: NavParams,
private modalController: ModalController,
private httpErrorHandle: HttpErrorHandle
) {
this.folder = new PublicationFolder();
this.folderId = this.navParams.get('folderId');
@@ -117,14 +119,9 @@ export class EditActionPage implements OnInit {
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close();
this.updateDesktopComponent.emit();
this.toastService._successMessage('Acção presidencial atualizada')
this.httpErrorHandle.httpsSucessMessagge('Editar publicação');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Não foi possivel atualizar a acção presidencial')
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -88,7 +88,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-textarea-class" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom ">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção*"></ion-textarea>
</div>
</div>
</div>
@@ -7,6 +7,7 @@ import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -65,7 +66,8 @@ export class NewActionPage implements OnInit {
constructor(
private modalController: ModalController,
private publication: PublicationsService,
private toastService: ToastService
private toastService: ToastService,
private httpErroHandle: HttpErrorHandle
) {
@@ -138,11 +140,11 @@ export class NewActionPage implements OnInit {
try {
await this.publication.CreatePublicationFolder(this.folder).toPromise();
this.toastService._successMessage("Acção criada");
this.httpErroHandle.httpsSucessMessagge('Acção criada')
this.close();
} catch (error) {
this.toastService._badRequest("Acção não criada");
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -18,6 +18,7 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera
import { Filesystem, Directory } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress";
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const IMAGE_DIR = 'stored-images';
@@ -85,6 +86,7 @@ export class NewPublicationPage implements OnInit {
private platform: Platform,
private loadingCtrl: LoadingController,
public imageCompress: NgxImageCompressService,
private httpErrorHandle: HttpErrorHandle
) {
this.publicationType = this.navParams.get('publicationType');
@@ -198,14 +200,14 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
//Validators.required,
Validators.required,
// Validators.minLength(4)
]),
capturedImage: new FormControl(this.capturedImage, [
]),
Message: new FormControl(this.pub.Message, [
// Validators.required
Validators.required,
Validators.maxLength(1000)
])
@@ -241,11 +243,11 @@ export class NewPublicationPage implements OnInit {
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação editada")
this.httpErrorHandle.httpsSucessMessagge('Publicação Editada')
this.close();
} catch (error) {
this.toastService._badRequest("Publicação não editada")
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -269,11 +271,11 @@ export class NewPublicationPage implements OnInit {
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação criado")
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close();
} catch (error) {
this.toastService._badRequest("Publicação não criado")
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -297,11 +299,11 @@ export class NewPublicationPage implements OnInit {
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação criado")
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close();
} catch (error) {
this.toastService._badRequest("Publicação não criado")
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -333,12 +335,12 @@ export class NewPublicationPage implements OnInit {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close();
this.toastService._successMessage("Publicação criado")
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close();
} catch (error) {
this.toastService._badRequest("Publicação não criado")
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -9,6 +9,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { RouteService } from 'src/app/services/route.service';
import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-publication-detail',
@@ -30,6 +31,7 @@ export class PublicationDetailPage implements OnInit {
private RouteService: RouteService,
public ThemeService: ThemeService,
public p:PermissionService,
private httpErrorHandle: HttpErrorHandle
) {
this.activatedRoute.paramMap.subscribe(params => {
@@ -87,6 +89,9 @@ export class PublicationDetailPage implements OnInit {
FileExtension: 'jpeg',
}
this.showLoader = false;
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
this.goBack();
});
}
@@ -109,7 +114,7 @@ export class PublicationDetailPage implements OnInit {
try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService._successMessage('Publicação removida')
this.httpErrorHandle.httpsSucessMessagge('Eliminar publicação')
if(window['app-view-publications-page-doRefresh']) {
window['app-view-publications-page-doRefresh']()
@@ -117,7 +122,7 @@ export class PublicationDetailPage implements OnInit {
this.goBack();
} catch (error) {
this.toastService._badRequest('Publicaçao não removida')
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -13,6 +13,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { forkJoin } from 'rxjs';
import { ToastService } from 'src/app/services/toast.service';
import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-view-publications',
@@ -44,7 +45,8 @@ export class ViewPublicationsPage implements OnInit {
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private toastService: ToastService,
public p: PermissionService,) {
public p: PermissionService,
private httpErroHandle: HttpErrorHandle) {
this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => {
@@ -119,6 +121,8 @@ export class ViewPublicationsPage implements OnInit {
this.item = res;
this.sqliteservice.updatePublicationsDetails(this.folderId, JSON.stringify(res));
}, (error) => {
this.httpErroHandle.httpStatusHandle(error)
});
}
@@ -161,7 +165,12 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = false;
}, (error) => {
this.getFromDB()
if(error.status == 0) {
this.getFromDB()
} else {
this.httpErroHandle.httpStatusHandle(error)
}
});
}
@@ -196,6 +205,8 @@ export class ViewPublicationsPage implements OnInit {
if (error.status == '404') {
this.error = 'Sem publicações disponíveis!';
this.publicationList = [];
} else {
this.httpErroHandle.httpStatusHandle(error)
}
this.showLoader = false;
});