This commit is contained in:
Peter Maquiran
2023-09-19 10:21:23 +01:00
parent 527cc0f2a6
commit f51bd246fc
29 changed files with 754 additions and 261 deletions
+19 -23
View File
@@ -37,8 +37,8 @@ export class NewGroupPage implements OnInit{
@Input() groupName:string;
@Output() addGroupMessage:EventEmitter<any> = new EventEmitter<any>();
@Output() closeAllDesktopComponents:EventEmitter<any> = new EventEmitter<any>();
@Output() backToChat:EventEmitter<any> = new EventEmitter<any>();
@Output() backToChat:EventEmitter<any> = new EventEmitter<any>();
constructor(
private pickerController: PickerController,
@@ -57,23 +57,17 @@ export class NewGroupPage implements OnInit{
}
ngOnInit() {
console.log(this.dataService.get("task"))
this.task = this.dataService.get("task");
this.event = this.dataService.get("event");
console.log(this.task)
this
if(this.task) {
if(this.task && this.dataService.get("newGroup")) {
this.link = this.dataService.get("link");
this.groupName = this.task.Folio;
this.documents = this.dataService.get("documents");
this.dataService.set("newGroup", false);
this.dataService.set("link", false);
} else if (this.event) {
} else if (this.event && this.dataService.get("newGroup")) {
//
this.link = this.dataService.get("link");
this.groupName = this.event.Subject;
@@ -83,12 +77,14 @@ export class NewGroupPage implements OnInit{
this.dataService.set("newGroup", false);
this.dataService.set("link", false);
} else {
this.dataService.clear();
}
}
_ionChange(event) {
this.showDuration = event.detail.checked;
if(event.detail.checked) {
@@ -112,12 +108,12 @@ export class NewGroupPage implements OnInit{
this.viewContainerRef.clear();
this.closeAllDesktopComponents.emit();
}
}
}
async createGroup() {
let name = this.groupName.split(' ').join('-');
//Take out all special characters in string
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
@@ -132,12 +128,12 @@ export class NewGroupPage implements OnInit{
let customFields = {
"countDownDate":this.thedate
}
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
else {
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
loader.remove();
@@ -146,23 +142,23 @@ export class NewGroupPage implements OnInit{
if(res?.result?.rid) {
this.addGroupMessage.emit(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!');
}
@@ -224,7 +220,7 @@ export class NewGroupPage implements OnInit{
this.close();
let name = this.groupName.split(' ').join('-');
const modal = await this.modalController.create({
component: GroupContactsPage,
@@ -263,7 +259,7 @@ export class NewGroupPage implements OnInit{
text: 'Ok',
cssClass: 'btn-cancel',
handler:(value:any)=>{
let now = new Date();
this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
@@ -272,7 +268,7 @@ export class NewGroupPage implements OnInit{
value.hours.value,
value.minutes.value,
]
if(value.days.value != null && value.hours.value != null && value.minutes.value != null){
if(value.days.value > 0){
if(value.days.value == 1){