<div class="custom_loader_wrapper" *ngIf="loader">
    <div class="custom_loader_ring"></div>
</div>
<header class="provider_header">
    <div class="row">
      <div class="col-md-6">
        <h4>{{'forexprovider.Forex Provider' | translate}}</h4>
      </div>
      <div class="col-md-6 textRight relative">
          <button class="logout" (click)="goToPage('checker/home')">
            <img src="assets/images/asset_home.png">
           {{'forexprovider.Home' | translate}}</button>
          <button class="logout" (click)="logout()">
              <img src="assets/images/asset_logout.png">
             {{'forexprovider.Logout' | translate}}</button>
          <img src="assets/images/asset_logo1.png">
          <span (click)="goToPage('checker/changepin')"> {{'forexprovider.Change PIN' | translate}}</span>
      </div>
    </div>
  </header>
<section>
    <div class="provider_content">
      <h3>{{'forexprovider.Manage Forex Provider' | translate}}</h3>
      <div class="provider_inner_content">
          <div class="table-responsive">   
              <div class="alert alert-danger alert-dismissible" *ngIf="error">
                  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                  <strong> {{'forexprovider.Warning!' | translate}}</strong> {{responseMsg}}
              </div>
              <div class="alert alert-success alert-dismissible" *ngIf="success">
                  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                  <strong> {{'forexprovider.Success!' | translate}}</strong>  {{'forexprovider.Forex provider removed successfully' | translate}}
                </div>  
                
                <div class="row">
                    <div class="col"></div>
                    <div class="col" style="text-align: right"><input type="text" placeholder="{{'manageprovider.Search...' | translate}}" (input)="onSearchChange($event.target.value)" /></div>
                  </div>     
              <table class="table">
                <thead>
                  <tr>
                    <th> {{'forexprovider.Provider Name' | translate}}</th>
                    <th> {{'forexprovider.Location' | translate}}</th>
                    <th> {{'forexprovider.CR Manager' | translate}}</th>
                    <th> {{'forexprovider.CR ID' | translate}}</th>
                    <th> {{'forexprovider.Contact Name' | translate}}</th>
                    <th> {{'forexprovider.Phone' | translate}}</th>
                    <th> {{'forexprovider.Email ID' | translate}}</th>
                    <th> {{'forexprovider.Action' | translate}}</th>
                  </tr>
                </thead>
                <tbody *ngIf="providerList; else noProvider">
                  <tr *ngFor="let provider of providerList;">
                    <td>{{provider.name | titlecase}}</td>
                    <td>{{provider.location | titlecase}}</td>
                    <td>{{provider.cr_manager | titlecase}}</td>
                    <td>{{provider.cr_id}}</td>
                    <td>{{provider.contact | titlecase}}</td>
                    <td>{{provider.phone}}</td>
                    <td>{{provider.email_id}}</td>
                    <td *ngIf="provider.status != 0">{{get_status(provider.status)}}</td>
                    <td class="textRight pl0 pr0" *ngIf="provider.status == 0">
                      <button class="edit_btn" data-toggle="modal" data-target="#forexapproved" (click)="providerDetails(provider.id)"></button>
                    </td>
                  </tr>
                </tbody>                
              </table>
              
              <div class="forex_pagination" *ngIf="meta">
                  <ul>
                      <li *ngFor="let i of getNumber(meta.total_pages); let j = index" [ngClass]="{'activeClass': meta.current_page == j+1}" (click)="getProvider(j+1)">{{j+1}}</li>
                  </ul>
                 
                </div>
              <ng-template #noProvider></ng-template>
          </div>
      </div>
    </div>
  </section>


  <div class="modal" id="forexapproved" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="max-width: 700px !important;">
      <div class="modal-content">

        <div class="forex_modal_wrapper">
          <div class="forex_modal_header">
              <h5 class="floatLeft">Forex Provider Approve</h5>
              <button type="button" class="close floatRight" data-dismiss="modal">&times;</button>
              <div class="clear"></div>
          </div> 
          <div class="forex_inner_wrapper" *ngIf="provider">
            <div class="row">
              <div class="col">
                  <div class="row">
                      <div class="col">Provider Name:</div>
                      <div class="col">{{provider.name}}</div>
                    </div>
              </div>
              <div class="col">
                  <div class="row">
                      <div class="col">Location:</div>
                      <div class="col">{{provider.location}}</div>
                    </div>
              </div>
            </div>

            <div class="row">
                <div class="col">
                    <div class="row">
                        <div class="col">CR ID:</div>
                        <div class="col">{{provider.cr_id}}</div>
                      </div>
                </div>
                <div class="col">
                    <div class="row">
                        <div class="col">CR Manager:</div>
                        <div class="col">{{provider.cr_manager}}</div>
                      </div>
                </div>
              </div>

              <div class="row">
                  <div class="col">
                      <div class="row">
                          <div class="col">Email ID:</div>
                          <div class="col">{{provider.email_id}}</div>
                        </div>
                  </div>
                  <div class="col">
                      <div class="row">
                          <div class="col">Phone:</div>
                          <div class="col">{{provider.phone}}</div>
                        </div>
                  </div>
                </div>

                <div class="row">
                  <div class="col">
                      <div class="row">
                          <div class="col">Delivery Provider:</div>
                          <div class="col">{{deli_provider}}</div>
                        </div>
                  </div>
                  <div class="col">
                      <div class="row">
                          <div class="col">Merchant ID:</div>
                          <div class="col">{{provider.merchant_id}}</div>
                        </div>
                  </div>
                </div>
          </div>
          <div class="forex_modal_footer_btn_bay textRight">
            <button class="okay_btn" data-dismiss="modal" (click)="providerState(2, provider.users_id)">Reject</button>
            <button class="cancel_btn" data-dismiss="modal" (click)="providerState(1, provider.users_id)">Approve</button>
          </div>
        </div>
      </div>
    </div>
  </div>
