Skip to content
Merged
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
6 changes: 0 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ export class AppComponent implements OnInit {
this.refreshApi.stopInterval();
let info = ev.value as LoginInfo;

console.log('STARTING INTERVAL')
console.log(info.expire)
console.log(((info.expire - moment().unix()) - 4))

this.refreshApi.startInterval(((info.expire - moment().unix())-4)*1000, ev);
initFlowbite();
//this.refreshApi.startInterval(3000, ev.value);
Expand All @@ -90,8 +86,6 @@ export class AppComponent implements OnInit {
else if (((aux.expire - moment().unix())-4) > 0) {
this.refreshApi.stopInterval();
this.refreshApi.startInterval(((aux.expire - moment().unix())-4)*1000, aux);
console.log('token')
console.log(aux.token)
initFlowbite();
}
this.router.events.subscribe(event => {
Expand Down
19 changes: 1 addition & 18 deletions src/app/pages/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.startTagTransition();
})
this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string);
//this.route.snapshot.paramMap.get('id');
console.log('--- route data')
console.log(this.route.queryParams)
console.log(this.route.snapshot.queryParamMap.get('token'))
if(this.route.snapshot.queryParamMap.get('token') != null){
this.loginService.getLogin(this.route.snapshot.queryParamMap.get('token')).then(data => {
console.log('---- loginangular response ----')
console.log(data)
console.log(data.username)
let info = {
"id": data.id,
"user": data.username,
Expand All @@ -120,30 +113,20 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.localStorage.addLoginInfo(info);
this.eventMessage.emitLogin(info);
initFlowbite();
console.log('----')
//this.refreshApi.stopInterval();
//this.refreshApi.startInterval(((data.expire - moment().unix())-4)*1000, data);
//this.refreshApi.startInterval(3000, data);
})
this.router.navigate(['/dashboard'])
} else {
console.log('sin token')
//this.localStorage.clear()
let aux = this.localStorage.getObject('login_items') as LoginInfo;
if (JSON.stringify(aux) != '{}') {
console.log(aux)
console.log('moment')
console.log(aux['expire'])
console.log(moment().unix())
console.log(aux['expire'] - moment().unix())
console.log(aux['expire'] - moment().unix() <= 5)
}
// keep stored session data if present
}

this.showContact = true;

this.cdr.detectChanges();
console.log('----')
}

ngOnDestroy(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
getProfile(){
this.contactmediums=[];
this.accountService.getOrgInfo(this.partyId).then(data=> {
console.log('--org info--')
console.log(data)
this.profile=data;
this.loadProfileData(this.profile)
this.loading=false;
Expand Down Expand Up @@ -217,7 +215,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
})
}
for(let i=0; i<this.contactmediums.length; i++){
console.log(this.contactmediums)
if(this.contactmediums[i].mediumType == 'Email'){
mediums.push({
mediumType: 'Email',
Expand All @@ -227,7 +224,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
emailAddress: this.contactmediums[i].characteristic.emailAddress
}
})
console.log(this.contactmediums[i])
} else if(this.contactmediums[i].mediumType == 'PostalAddress'){
mediums.push({
mediumType: this.contactmediums[i].mediumType,
Expand Down Expand Up @@ -258,7 +254,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
"contactMedium": mediums,
"partyCharacteristic": chars
}
console.log(profile)
this.accountService.updateOrgInfo(this.partyId,profile).subscribe({
next: data => {
this.profileForm.reset();
Expand All @@ -272,7 +267,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
error: error => {
console.error('There was an error while updating!', error);
if(error.error.error){
console.log(error)
this.errorMessage='Error: '+error.error.error;
} else {
this.errorMessage='There was an error while updating profile!';
Expand Down Expand Up @@ -349,7 +343,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber);
if (phoneNumber) {
if (!phoneNumber.isValid()) {
console.log('NUMERO INVALIDO')
this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true});
this.toastVisibility = true;
setTimeout(() => {
Expand Down Expand Up @@ -415,7 +408,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
}
}
this.mediumForm.reset();
console.log(this.contactmediums)
}

removeMedium(medium:any){
Expand Down Expand Up @@ -477,7 +469,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber);
if (phoneNumber) {
if (!phoneNumber.isValid()) {
console.log('NUMERO INVALIDO')
this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true});
this.toastVisibility = true;
setTimeout(() => {
Expand Down Expand Up @@ -541,7 +532,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
}

selectPrefix(pref:any) {
console.log(pref)
this.prefixCheck = false;
this.phonePrefix = pref;
}
Expand Down Expand Up @@ -614,32 +604,22 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
this.mediumForm.get('telephoneNumber')?.setValue('');
this.cdr.detectChanges();
}
console.log(this.mediumForm)
console.log(this.printAllActiveValidators());

}
showMedium(){
console.log('--- SHOW MEDIUM')
console.log(this.mediumForm)
console.log(this.printAllActiveValidators());
console.log('--value')
console.log(this.mediumForm.get('email')?.value)
}

printActiveValidators(controlName: string) {
const control = this.mediumForm.get(controlName);
if (!control || !control.validator) {
console.log(`No active validators for ${controlName}`);
return;
}

const validatorFn = control.validator({} as AbstractControl);
if (!validatorFn) {
console.log(`No active validators for ${controlName}`);
return;
}

console.log(`Active validators for ${controlName}:`, Object.keys(validatorFn));
}

printAllActiveValidators() {
Expand All @@ -658,14 +638,11 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
if (droppedFile.fileEntry.isFile) {
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
fileEntry.file((file: File) => {
console.log('dropped')

if (file) {
const reader = new FileReader();
reader.onload = (e: any) => {
const base64String: string = e.target.result.split(',')[1];
console.log('BASE 64....')
console.log(base64String); // You can use this base64 string as needed
let fileBody = {
content: {
name: 'orglogo'+file.name,
Expand Down Expand Up @@ -695,7 +672,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
}
this.attachmentService.uploadFile(fileBody).subscribe({
next: data => {
console.log(data)
if(sel=='img'){
if(file.type.startsWith("image")){
this.showImgPreview=true;
Expand All @@ -709,12 +685,10 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
}
}
this.cdr.detectChanges();
console.log('uploaded')
},
error: error => {
console.error('There was an error while uploading!', error);
if(error.error.error){
console.log(error)
this.errorMessage='Error: '+error.error.error;
} else {
this.errorMessage='There was an error while uploading the file!';
Expand All @@ -736,7 +710,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
} else {
// It was a directory (empty directories are added, otherwise only files)
const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry;
console.log(droppedFile.relativePath, fileEntry);
}
}
}
Expand All @@ -746,12 +719,9 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
}

public fileOver(event: any){
console.log(event);
}

public fileLeave(event: any){
console.log('leave')
console.log(event);
}

saveImgFromURL(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ export class UserInfoComponent implements OnInit, OnDestroy {
} else {
let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as)
this.partyId = loggedOrg.partyId
console.log(aux.organizations)
this.accountService.getOrgInfo(this.partyId).then(data=> {
console.log('org')
console.log(data)
})
}
this.token=aux.token;
Expand All @@ -98,7 +95,6 @@ export class UserInfoComponent implements OnInit, OnDestroy {

getProfile(){
this.accountService.getUserInfo(this.partyId).then(data=> {
console.log(data)
this.profile=data;
this.loadProfileData(this.profile)
this.loading=false;
Expand All @@ -122,8 +118,7 @@ export class UserInfoComponent implements OnInit, OnDestroy {
"placeOfBirth": this.userProfileForm.value.city,
"title": this.userProfileForm.value.treatment,
"birthDate": this.userProfileForm.value.birthdate
}
console.log(profile)
}
this.accountService.updateUserInfo(this.partyId,profile).subscribe({
next: data => {
this.userProfileForm.reset();
Expand Down
3 changes: 0 additions & 3 deletions src/app/pages/user-profile/user-profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,13 @@ export class UserProfileComponent implements OnInit, OnDestroy {
if(elem != null){
if(elem.className.match(cls)){
this.removeClass(elem,cls)
} else {
console.log('already unselected')
}
}
}

selectMenu(elem:HTMLElement| null,cls:string){
if(elem != null){
if(elem.className.match(cls)){
console.log('already selected')
} else {
this.addClass(elem,cls)
}
Expand Down
4 changes: 0 additions & 4 deletions src/app/services/event-message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,10 @@ export class EventMessageService {
}

emitCategoryAdded(cat:Category){
console.log('event emitter category')
console.log(cat)
this.eventMessageSubject.next({ type: 'CategoryAdded', value: cat });
}

emitChangedSession(session:any){
console.log('event eChangedSession')
console.log(session)
this.eventMessageSubject.next({ type: 'ChangedSession', value: session });
}

Expand Down
21 changes: 0 additions & 21 deletions src/app/services/refresh-login-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,8 @@ export class RefreshLoginServiceService {
startInterval(intervalDuration: number, data:any): void {
this.intervalObservable = interval(intervalDuration);

console.log('start interval')
console.log(intervalDuration)

this.intervalSubscription = this.intervalObservable.subscribe(() => {
console.log('login subscription')
console.log(data.expire - moment().unix())
console.log(data.expire - moment().unix() <= 5)
console.log((data.expire - moment().unix()) - 5)

let aux = this.localStorage.getObject('login_items') as LoginInfo;

console.log('usuario antes')
console.log(aux)

this.api.getLogin(aux['token']).then(refreshed => {
this.stopInterval()

Expand All @@ -54,9 +42,6 @@ export class RefreshLoginServiceService {
"logged_as": aux['logged_as']
});

console.log('usuario despues')
console.log(this.localStorage.getObject('login_items') as LoginInfo)

// Start the interval only if the token has been really refreshed
// Otherwise close the session
if (refreshed.expire > moment().unix() + 4) {
Expand All @@ -65,16 +50,11 @@ export class RefreshLoginServiceService {
this.stopInterval();
this.localStorage.setObject('login_items',{});
this.api.logout().catch((err) => {
console.log('Something happened')
console.log(err)
})

this.router.navigate(['/dashboard']).then(() => {
console.log('LOGOUT MADE')
window.location.reload()
}).catch((err) => {
console.log('Something happened router')
console.log(err)
})
}
})
Expand All @@ -83,7 +63,6 @@ export class RefreshLoginServiceService {

stopInterval(): void {
if (this.intervalSubscription) {
console.log('stop interval')
this.intervalSubscription.unsubscribe();
}
}
Expand Down
Loading
Loading