mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
replicate contact function
This commit is contained in:
@@ -3,11 +3,9 @@ import { ModalController, NavParams, PickerController, PopoverController } from
|
||||
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
|
||||
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-group',
|
||||
@@ -32,6 +30,7 @@ export class NewGroupPage implements OnInit {
|
||||
private navParams: NavParams,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.loggedUserChat = SessionStore.user.ChatData['data'];
|
||||
this.isGroupCreated = false;
|
||||
@@ -88,6 +87,82 @@ export class NewGroupPage implements OnInit {
|
||||
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
}, 10)
|
||||
|
||||
|
||||
|
||||
if(res?.result?.rid) {
|
||||
|
||||
this.ChatSystemService.getAllRooms(() => {
|
||||
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
} else {
|
||||
setTimeout(()=> {
|
||||
|
||||
this.createGroupWithAttachments(res)
|
||||
|
||||
}, 500)
|
||||
}
|
||||
}, res.result.rid);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest('Existe um grupo com este nome!');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
createGroupWithAttachmentsCath(res: any) {
|
||||
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
setTimeout(()=>{
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
}, 1500)
|
||||
} else {
|
||||
this.createGroupWithAttachments(res)
|
||||
}
|
||||
}
|
||||
|
||||
createGroupWithAttachments(res: any) {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
|
||||
|
||||
if(this.documents) {
|
||||
this.documents.forEach(element => {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).send({
|
||||
file: {
|
||||
"name": element.Assunto,
|
||||
"type": "application/webtrix",
|
||||
"ApplicationId": element.ApplicationId,
|
||||
"DocId": element.DocId,
|
||||
"Assunto": element.Assunto,
|
||||
},
|
||||
temporaryData: {
|
||||
data: {
|
||||
selected: {
|
||||
Id: element.DocId,
|
||||
ApplicationType: element.ApplicationId
|
||||
}
|
||||
}
|
||||
},
|
||||
attachments: [{
|
||||
"title": element.Assunto,
|
||||
"description": element.Assunto,
|
||||
"title_link_download": true,
|
||||
"type": "webtrix",
|
||||
"text": element.Assunto,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.ChatSystemService.getAllRooms();
|
||||
|
||||
setTimeout(() => {
|
||||
this.groupName = ""
|
||||
}, 150);
|
||||
}
|
||||
|
||||
async addContacts(room) {
|
||||
|
||||
Reference in New Issue
Block a user