<div id="layout-wrapper">
    <div class="inner-pg-sp">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="d-sm-flex align-items-center justify-content-between navbar-header p-0">

                    </div>
                </div>
            </div>
            <div class="container-fluid">
                <div class="col-xl-12 mt-4">
                    <div class="card border">
                        <div class="card-body">
                            <div class="table-section">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="card-body mt-2 p-0">
                                            <div class="card mb-0 mt-2">
                                                <div
                                                    class="card-header font-edit-13-child d-flex justify-content-between align-items-center">
                                                    {{'thirdPartyRegistration' | translate}}
                                                </div>
                                                <div class="card-body">
                                                    <form [formGroup]="thirdPartyRegForm">
                                                        <div class="row g-3 mb-3">
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-center gap-2">
                                                                    <label for="renewalDate" class="text-nowrap">
                                                                        {{ 'ThirdPartyID' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="password-wrapper position-relative w-100">
                                                                        <input type="text" id="thirdPartyId"
                                                                            formControlName="thirdPartyId"
                                                                            class="form-control"
                                                                            placeholder="{{ 'ThirdPartyID' | translate }}" />
                                                                      
                                                                    
                                                                    <div class="text-danger"
                                                                        *ngIf="thirdPartyRegForm.get('thirdPartyId')?.touched && thirdPartyRegForm.get('thirdPartyId')?.invalid">
                                                                        {{ 'fieldRequired' | translate }}
                                                                    </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-start gap-2">
                                                                    <label for="renewalRemarks"
                                                                        class="text-nowrap mt-2">
                                                                        {{ 'name' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="d-flex flex-column w-100">
                                                                        <input type="text" id="thirdPartyName"
                                                                            class="form-control"
                                                                            formControlName="thirdPartyName"
                                                                            placeholder="{{ 'thirdPartyNamePlaceholder' | translate }}" />
                                                                    
                                                                    <div class="text-danger" *ngIf="thirdPartyRegForm.get('thirdPartyName')?.touched && thirdPartyRegForm.get('thirdPartyName')?.invalid">
                                                                        {{ 'fieldRequired' | translate }}
                                                                    </div>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="row g-3 mb-3">
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-center gap-2">
                                                                    <label for="email" class="text-nowrap">
                                                                        {{ 'Email' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="d-flex flex-column w-100">
                                                                        <input type="text" id="renewalDate"
                                                                            class="form-control"
                                                                            formControlName="email"
                                                                            placeholder="{{ 'Email' | translate }}" />
                                                            
                                                                    
                                                                    <div class="text-danger" *ngIf="thirdPartyRegForm.get('email')?.errors?.['required'] 
                                                                                                    && thirdPartyRegForm.get('email')?.touched">
                                                                        {{ 'fieldRequired' | translate }}
                                                                    </div>
                                                                    <div class="text-danger" *ngIf="thirdPartyRegForm.get('email')?.errors?.['email'] 
                                                                                                    && thirdPartyRegForm.get('email')?.touched">
                                                                        {{"invalidEmail" | translate}}
                                                                    </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-start gap-2">
                                                                    <label for="renewalRemarks"
                                                                        class="text-nowrap mt-2">
                                                                        {{ 'Address' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="d-flex flex-column w-100">
                                                                        <input type="text" id="address"
                                                                            class="form-control"
                                                                            formControlName="address"
                                                                            placeholder="{{ 'Address' | translate }}" />
                                                                    
                                                                    <div class="text-danger" *ngIf="thirdPartyRegForm.get('address')?.touched && thirdPartyRegForm.get('address')?.invalid">
                                                                        {{ 'fieldRequired' | translate }}
                                                                    </div>
                                                                    </div>

                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="row g-3 mb-3">
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-center gap-2">
                                                                    <label for="renewalDate" class="text-nowrap">
                                                                        {{ 'phoneNumber' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="d-flex flex-column w-100">
                                                                        <input type="text" id="phoneNumber"
                                                                            class="form-control"
                                                                            formControlName="phoneNumber"
                                                                            placeholder="{{ 'phoneNumberPlaceholder' | translate }}" />
                                                                        
                                                                    
                                                                <div class="text-danger"
                                                                    *ngIf="thirdPartyRegForm.get('phoneNumber')?.touched && thirdPartyRegForm.get('phoneNumber')?.errors?.['required']">
                                                                    {{ 'fieldRequired' | translate }}
                                                                </div>
                                                                <div class="text-danger" *ngIf="thirdPartyRegForm.get('phoneNumber')?.touched 
                                                                         && thirdPartyRegForm.get('phoneNumber')?.errors?.['pattern']">
                                                                    {{"regPhoneNo"|translate}}
                                                                </div>
                                                                </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-start gap-2">
                                                                    <label for="renewalRemarks"
                                                                        class="text-nowrap mt-2">
                                                                        {{ 'NewNoOfAccounts' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="d-flex flex-column w-100">
                                                                        <input type="text" id="newNumberOfAccounts"
                                                                            class="form-control"
                                                                            formControlName="newNumberOfAccounts"
                                                                            placeholder="{{ 'newNoOfAccountsPlaceholder' | translate }}" />
                                                                    
                                                                     <div class="text-danger" *ngIf="thirdPartyRegForm.get('newNumberOfAccounts')?.touched && thirdPartyRegForm.get('newNumberOfAccounts')?.invalid">
                                                                        {{ 'fieldRequired' | translate }}
                                                                    </div>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="row g-3 mb-3">
                                                            <div class="col-md-6">
                                                                <div class="d-flex align-items-start gap-2">
                                                                    <label for="renewalRemarks"
                                                                        class="text-nowrap mt-2">
                                                                        {{ 'password' | translate }}<span
                                                                            class="mandatory">*</span>
                                                                    </label>
                                                                    <div class="password-wrapper position-relative w-100">
                                                                        <input [type]="passwordType" autocomplete="new-password" class="form-control pe-5" formControlName="password"
                                                                            placeholder="{{ 'password' | translate }}">
                                                                        <app-password-hide-show class="password-eye" [showPassword]="true" (onEyeClick)="togglePasswordType()">
                                                                        </app-password-hide-show>
                                                                    
                                                                        <div class="text-danger"
                                                                            *ngIf="thirdPartyRegForm.get('password')?.touched && thirdPartyRegForm.get('password')?.errors?.['required']">
                                                                            {{ 'fieldRequired' | translate }}
                                                                        </div>
                                                                        <div class="text-danger" *ngIf="passwordError">
                                                                            {{ 'passwordTooShort' | translate }}
                                                                        </div>
                                                                    
                                                                    </div>

                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="row g-3 mb-3">
                                                            <div class="col-md-6 ms-auto text-end">
                                                                <button class="btn btn-primary waves-effect waves-light" (click)=" onSubmit()">{{'save'
                                                                    |
                                                                    translate}}</button>
                                                               
                                                            </div>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="container-fluid">
                <div class="col-xl-12 mt-4">
                    <div class="card border">
                        <div class="card-body">
                            <div class="table-section">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="card-body mt-2 p-0">
                                            <div class="card mb-0 mt-2">
                                                <div
                                                    class="card-header font-edit-13-child d-flex justify-content-between align-items-center">
                                                    {{'thirdPartyRegistrationDetails' | translate}}
                                                    <div class="d-flex align-items-center gap-2">
                                                        <div class="search-box">
                                                            <input type="text" class="form-control form-control-sm"
                                                                [(ngModel)]="searchText"
                                                                placeholder="{{ 'search' | translate }}">
                                                            <i class="fas fa-search search-icon"></i>
                                                        </div>
                                                        <i class="materialdesignicons" (click)="toggleTableCard()">
                                                            <ng-container *ngIf="thirdPartyRegExpanded; else collapsedIcon">
                                                                <i class="dripicons-chevron-up float-end"></i>
                                                            </ng-container>
                                                            <ng-template #collapsedIcon>
                                                                <i class="dripicons-chevron-down float-end"></i>
                                                            </ng-template>
                                                        </i>
                                                    </div>
                                                </div>
                                                <!-- <div class="card-body"  *ngIf="thirdPartyRegExpanded && allItems.length; else noRecordsFound"> -->
                                                <div class="card-body"  *ngIf="thirdPartyRegExpanded; else noRecordsFound">
                                                    <div class="table-responsive">
                                                        <table class="table mb-0 border">
                                                            <thead class="table-light">
                                                                <tr>
                                                                    <th>{{'ThirdPartyID' | translate}}</th>
                                                                    <th>{{'name' | translate}}</th>
                                                                    <th>{{'Email' | translate}}</th>
                                                                    <th>{{'Address' | translate}}</th>
                                                                    <th>{{'phoneNumber' | translate}}</th>
                                                                    <th>{{'TotalNoOfAccounts' | translate}}</th>
                                                                    <th>{{'action' | translate}}</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <tr>
                                                                    <td></td>
                                                                    <td></td>
                                                                    <td></td>
                                                                    <td></td>
                                                                    <td></td>
                                                                    <td></td>
                                                                    <td>
                                                                        <div
                                                                            class="d-flex justify-content-center gap-2">

                                                                            <button class="btn btn-info btn-sm"
                                                                                title="View">
                                                                                <i class="mdi mdi-eye-outline"></i>
                                                                            </button>

                                                                            <button *ngIf="buttonPermissions?.edit" class="btn btn-secondary btn-sm"
                                                                                title="Edit">
                                                                                <i class="fas fa-pen"></i>
                                                                            </button>


                                                                            <button *ngIf="buttonPermissions?.delete" class="btn btn-danger btn-sm"
                                                                                title="Delete">
                                                                                <i class="fas fa-trash-alt"></i>
                                                                            </button>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                        <div class="d-flex justify-content-between align-items-center mt-3">
                              <div class="form-group mb-0">
                            <ng-select class="form-select-sm" [items]="pageSizeOptions" bindLabel="label" bindValue="value"
                                [(ngModel)]="itemsPerPage" [searchable]="false" [clearable]="false" appendTo="body" [dropdownPosition]="'top'">
                            </ng-select>

                              </div>
                            
                               <div class="text-muted">
                                {{'page' | translate}} {{'of' | translate}} ( {{'totalItems' | translate}})
                              </div>
                                                    
                              <div class="btn-group">
                                <button class="btn btn-primary waves-effect waves-light">
                                  {{'previous' | translate}}
                                </button>
                                <button class="btn btn-primary waves-effect waves-light">
                                  {{'next' | translate}}
                                </button>
                              </div>
                            </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<ng-template #noRecordsFound>
    <div *ngIf="!isLoading && allItems.length === 0" class="text-center text-muted mt-3">
        <p>{{'noThirdPartyRegFound' | translate}}</p>
    </div>
</ng-template>