vendredi 24 juillet 2020

How to get and store in array multiple value from checkbox?

The process is when I tick multiple checkbox, the Id store in array then I call closed ticket function to change status from open to closed

But I don't have idea how to get and store the id when I tick the checkbox and send to closedTicket function.

HTML :

 <button type="button" class="btn btn-secondary btn-bold ml-1" (click)="closedTicket()">
     <i class="fa fa-check-square" style="font-size: 1rem;"></i>
     
 </button>


<td style="width: 40px; text-align:center">
     <input type="checkbox"  [idTicket]="record.ticket.id">
</td>

Ts:

statusId = 5;

@Input() idTicket: any[] = [];

closedTicket() {
    console.log(this.idTicket);

    swalWarning.fire({
        title: this.l("AreYouSureYouWantToClosed", "Ticket"),
        text: this.l("YouWontBeAbleToRevertThis"),
        showCancelButton: true,
        confirmButtonText: this.l("YesClosed")
    }).then((result) => {
        if (result.value) {
            this._ticketsServiceProxy.updateTicketStatusByIds(this.statusId, 
      this.idTicket).subscribe(e => {
                swalSuccess.fire({
                    title: this.l("SuccessfullyClosed"),
                    text: this.l("HasBeenClosed", "Ticket")
                })
                this.reloadPage();
            })
        }
    })

}

The table to tick checkbox: Image

Thank You




Aucun commentaire:

Enregistrer un commentaire