tickets.component.html 7.43 KB
Newer Older
Ooh-Ao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
<div class="row">
  <div class="col-12">
    <div class="card">
      <div class="card-body">
        <div class="row">
          <!-- Column -->
          <div class="col-md-6 col-lg-3 col-xlg-3">
            <div class="card card-hover">
              <div class="box bg-info cursor-pointer text-center" (click)="filterByStatus('All')">
                <h1 class="font-light text-white">{{ticketsList.length}}</h1>
                <h6 class="text-white">Total Tickets</h6>
              </div>
            </div>
          </div>
          <!-- Column -->
          <div class="col-md-6 col-lg-3 col-xlg-3">
            <div class="card card-hover">
              <div class="box bg-warning cursor-pointer text-center" (click)="filterByStatus('Pending')">
                <h1 class="font-light text-white">{{pending}}</h1>
                <h6 class="text-white">Pending</h6>
              </div>
            </div>
          </div>
          <!-- Column -->
          <div class="col-md-6 col-lg-3 col-xlg-3">
            <div class="card card-hover">
              <div class="box bg-success cursor-pointer text-center" (click)="filterByStatus('Open')">
                <h1 class="font-light text-white">{{open}}</h1>
                <h6 class="text-white">Open</h6>
              </div>
            </div>
          </div>
          <!-- Column -->
          <div class="col-md-6 col-lg-3 col-xlg-3">
            <div class="card card-hover">
              <div class="box bg-danger cursor-pointer text-center" (click)="filterByStatus('Closed')">
                <h1 class="font-light text-white">{{closed}}</h1>
                <h6 class="text-white">Closed</h6>
              </div>
            </div>
          </div>
          <!-- Column -->
        </div>
        <div class="row mb-4">
          <div class="col-md-6 col-lg-3 col-xl-2">
            <input type="text" class="form-control form-control-lg" type="text" name="search" [(ngModel)]='searchTerm'
              autocomplete="off" placeholder="Search here...">
          </div>
          <div class="col-md-6 col-lg-9 col-xl-10 text-md-right mt-4 mt-md-0">
            <button class="btn btn-lg btn-cyan text-white" (click)="openModal(editTicketModal, null)">
              <i class="fa fa-plus-square mr-2"></i>Add Ticket</button>
          </div>
        </div>
      </div>
      <div class="table-responsive">
        <table class="table mb-0 no-wrap v-middle">
          <tbody>
            <tr *ngFor='let ticket of filterTickets|slice: (page-1) * pageSize : (page-1) * pageSize + pageSize'>
              <td width="50" class="text-center">{{ticket.Id}}</td>
              <td class="text-center" width="150">
                <span class="label label-{{ ticket.Label }}">{{ ticket.Status }}</span>
              </td>
              <td class="ticket-desc">
                <p class="mb-1">
                  <ngb-highlight [result]="ticket.ticketTitle" [term]="searchTerm"></ngb-highlight>
                </p>
                <small class="text-truncate">
                  <ngb-highlight [result]="ticket.ticketDescription" [term]="searchTerm"></ngb-highlight>
                </small>
              </td>
              <td><small>Assign to:</small><br /> <strong>{{ticket.AgentName}}</strong></td>
              <td>{{ticket.Date | timeAgo }}</td>
              <td>
                <a href="javascript: void(0);" (click)="openModal(editTicketModal, ticket)" class="link mr-2"
                  placement="top" ngbTooltip="Edit">
                  <!-- <i class="mdi mdi-pencil"></i> -->
                  <i-feather name="edit" class="feather-sm"></i-feather>
                </a>
                <a href="javascript: void(0);" class="link" (click)="deleteTicket(ticket.Id)" placement="top"
                  ngbTooltip="Delete">
                  <i-feather name="trash-2" class="feather-sm text-danger"></i-feather>
                  <!-- <i class="mdi mdi-delete"></i> -->
                </a>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="d-flex justify-content-center mt-5">
        <ngb-pagination [(page)]="page" [pageSize]="pageSize" [collectionSize]="totalLengthOfCollection">
        </ngb-pagination>
      </div>
    </div>
  </div>
</div>

<ng-template #editTicketModal let-modal>

  <div class="modal-header">

    <h5 class="modal-title" id="editUserLabel">Edit Ticket</h5>

    <button type="button" class="close" (click)="closeBtnClick()" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>

  </div>

  <div class="modal-body">

    <form [formGroup]="editTicket" (ngSubmit)="onSubmit()">

      <div class="form-group row">
        <label for="title" class="col-sm-4 col-form-label">Title</label>
        <div class="col-sm-8">
          <input type="text" class="form-control" formControlName="ticketTitle" id="title"
            (input)=logValidationErrors(editTicket)>
          <span class="help-block" *ngIf="formsErrors.ticketTitle">
            {{formsErrors.ticketTitle}}
          </span>
        </div>
      </div>


      <div class="form-group row">
        <label for="description" class="col-sm-4 col-form-label">Ticket Description</label>
        <div class="col-sm-8">
          <input type="text" class="form-control" formControlName="ticketDescription" id="description"
            (input)=logValidationErrors(editTicket)>
          <span class="help-block" *ngIf="formsErrors.ticketDescription">
            {{formsErrors.ticketDescription}}
          </span>

        </div>
      </div>

      <div class="form-group row">
        <label for="date" class="col-sm-4 col-form-label">Date</label>
        <div class="col-sm-8">
          <input type="date" class="form-control" formControlName="Date" id="date" [(ngModel)]="ticketDate"
            (input)=logValidationErrors(editTicket)>
          <span class="help-block" *ngIf="formsErrors.Date">
            {{formsErrors.Date}}
          </span>


        </div>
      </div>

      <div class="form-group row">
        <label for="status" class="col-sm-4 col-form-label">Status</label>
        <div class="col-sm-8">
          <select class="form-control" formControlName="Status" (blur)=logValidationErrors(editTicket)>
            <option selected>Closed</option>
            <option>Open</option>
            <option>In Process</option>
          </select>
          <span class="help-block" *ngIf="formsErrors.Status">
            {{formsErrors.Status}}
          </span>
        </div>
      </div>
      <div class="form-group row">
        <label for="agent" class="col-sm-4 col-form-label">Assign To</label>
        <div class="col-sm-8">
          <select class="form-control" formControlName="AgentName" (blur)=logValidationErrors(editTicket)>
            <option>Steve</option>
            <option>Jack</option>
            <option>John</option>
            <option>Liam</option>
          </select>
          <span class="help-block" *ngIf="formsErrors.AgentName">
            {{formsErrors.AgentName}}
          </span>
        </div>
      </div>
      <div class="form-group row mt-4">
        <span class="col-sm-4 col-form-label"></span>
        <div class="col-sm-8">
          <button type="button" class="btn btn-secondary mr-2" (click)="closeBtnClick()">Close</button>

          <button type="submit" class="btn btn-primary" [disabled]="editTicket.invalid">Save</button>
        </div>
      </div>
      <div class="text-center"><small>New ticket will be shown on second page.</small></div>
    </form>
  </div>
</ng-template>