<mat-progress-bar mode="indeterminate" *ngIf="loading" color="warn"></mat-progress-bar>

<div class="backImg">

<div class="c-wrapper" style="margin:0">

    <!-- <nav class="navbar navbar-expand-lg" style="padding: 16.5px;">
        <div class="container">
          <p class="navbar-brand d-flex align-items-center" href="#">
            <img src="assets/img/emblem2.jpg" alt="" class="img-fluid" style="height: 40px;">
            Thrickodithanam SCB
          </p>
      
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
      
          <div class="collapse navbar-collapse justify-content-end" id="navbarNav">
            <ul class="navbar-nav">
              <li class="nav-item">
                <p class="nav-link home-link" >Home</p>
              </li>
              <li class="nav-item">
                <p class="nav-link contact-link" >Contact Us</p>
              </li>
            </ul>
          </div>
          
        </div>
      </nav>
    
      <nav class="navbar navbar-dark-responsive" style="background-image: url('assets/img/panel_background.jpg');padding: 56px;"> 
      </nav> -->


    <div *ngIf="!verifiedOtp" class="container">

        <div class="container" style="margin-top:20px;">
            <div class="row">
                <!-- <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"></div> -->
                <div class="col-12 col-sm-12 col-md-6 col-lg-5 col-xl-5">
                    <mat-card card="card-style" class="registerCard">
                        <mat-card-title>
                            <div class="row">
                                <!-- <img mat-card-image src="assets/accurate/images/salesapp.png" alt="logo"> -->

                            </div>
                        </mat-card-title>
                        <mat-card-subtitle style="text-align: left;">
                            <span class="loginSpan">{{ 'register' | translate }} </span>
                        </mat-card-subtitle>
                        <mat-card-content>
                            <div class="row">


                                <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10" style="margin-top: 20px;">
                                    <mat-form-field style="width: 100%">
                                        <input matInput [(ngModel)]="this.userDetails.email" type="text" placeholder="{{ 'email' | translate }}">
                                    </mat-form-field>
                                </div>

                                <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10" style="text-align: center;margin-top: 20px;">
                                    <button mat-raised-button (click)="sendOTP(otpValidation)"
                                    class="verifyOtpButton">{{ 'generateOtp' | translate }}</button>
                                </div>
                            </div>
                        </mat-card-content>
                    </mat-card>
                </div>
                <!-- <div class="col-sm-4"></div> -->
            </div>
        </div>
    </div>


    <ng-template #otpValidation>

        <div class="row">

            <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                <mat-form-field style="width: 100%" appearance="outline">
                    <mat-label>{{ 'enterOtp' | translate }}</mat-label>
                    <input matInput [(ngModel)]="userDetails.otp" type="text" placeholder="{{ 'enterOtp' | translate }}" style="width:100%;border-bottom: 0px;">
                    
                </mat-form-field>
            </div>
            <div class="col-12" style="text-align: center;">
            <span style="text-align: center;font-family: nucleo; color: #1e3d3b;">{{ 'Please check both inbox and spam folder for OTP.' | translate }}</span><br><br>
             </div><br>
            <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10" style="text-align: center;">
                <button mat-raised-button (click)="validation()" class="submitButton">{{ 'submit' |
                    translate }}</button>
            </div>
        </div>

    </ng-template>


    <div *ngIf="verifiedOtp">

        <div class="container">

            <div class="container" style="margin-top:20px;">
                <div class="row">
                    <!-- <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4"></div> -->
                    <div class="col-12 col-sm-12 col-md-6 col-lg-7 col-xl-7" style="align-items: center;justify-content: center;display: flex;">
                        <mat-card card="card-style" style="margin-top: -75px;" class="registerCard">
                            <mat-card-title>
                                <div class="row">
                                    <!-- <img mat-card-image src="assets/accurate/images/salesapp.png" alt="logo"> -->

                                </div>
                            </mat-card-title>
                            <mat-card-subtitle style="text-align: left;">
                                <span class="loginSpan">{{ 'register' | translate }} </span>
                            </mat-card-subtitle>
                            <mat-card-content>
                                <div class="row scroll-div" style="margin-top: 20px;overflow-y: scroll;max-height: 50vh;">

                                    <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                      

                                        <mat-form-field appearance="outline">
                                            <mat-label>User Name</mat-label>
                                               
                                                  <input matInput [(ngModel)]="this.userDetails.userName" style="width:100%;border-bottom: 0px;" type="text" placeholder="{{ 'name' | translate }}">

                                          </mat-form-field>
                                    </div>

                                    <!-- <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                        <mat-form-field style="width: 100%">
                                            <input matInput type="text" placeholder="{{ 'email' | translate }}">
                                        </mat-form-field>
                                    </div> -->

                                    <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                        <mat-form-field style="width: 100%" appearance="outline">
                                            <mat-label>Mobile Number</mat-label>
                                            <input matInput [(ngModel)]="this.userDetails.mobileNumber" type="text" placeholder="{{ 'mobileNumber' | translate }}" style="width:100%;border-bottom: 0px;" >
                                        </mat-form-field>
                                    </div>

                                    <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                        <mat-form-field style="width: 100%" appearance="outline">
                                            <mat-label>Password</mat-label>
                                            <input matInput [(ngModel)]="this.userDetails.pass" type="password"  placeholder="{{ 'password' | translate }}" style="width:100%;border-bottom: 0px;" >
                                        </mat-form-field>
                                    </div>

                                    <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                        <mat-form-field style="width: 100%" appearance="outline">
                                            <mat-label>Confirm Password</mat-label>
                                            <input matInput [(ngModel)]="this.userDetails.confPass" type="password"  placeholder="{{ 'confPass' | translate }}" style="width:100%;border-bottom: 0px;" >
                                        </mat-form-field>
                                    </div>
 
                                 
                                      <!-- <form [formGroup]="categoryConfigurationForm">

                                      <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                        <mat-form-field appearance="outline" style="width: 108%;margin-left: 24px;">
                                            <mat-label>Category</mat-label>
                                            <mat-select multiple formControlName="selection" style="border: none;">
                                                <mat-option #allSelection (click)="toggleAllSelection('select')" [value]="0" >All category</mat-option>
                                                
                                                <mat-optgroup *ngFor="let categoryGroup of categoryList" [label]="categoryGroup.tenderCategory"  >
                                                    <mat-option *ngFor="let sub of categoryGroup.tenderSubCategory" [value]="sub.id" (click)="tosslePerOne('select')">
                                                        {{sub.tenderSubCategory}}
                                                    </mat-option>
                                                </mat-optgroup>
                                            </mat-select>
                                        </mat-form-field>
                                    </div>
                                    </form> -->
<!-- 2/6/24-->
                                    <!-- <form [formGroup]="categoryConfigurationForm">
                                        <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                          <mat-form-field appearance="outline" style="width: 108%; margin-left: 24px;">
                                            <mat-label>Category</mat-label>
                                            <mat-select multiple formControlName="selection" style="border: none;">
                                              <mat-option #allSelection (click)="toggleAllSelection()" [value]="0">All category</mat-option>
                                              <mat-optgroup *ngFor="let categoryGroup of categoryList" >
                                                <mat-checkbox (change)="toggleOptGroupSelection(categoryGroup)" style="color:black;" >
                                                  {{ categoryGroup.tenderCategory }}
                                                </mat-checkbox>
                                                <mat-option *ngFor="let sub of categoryGroup.tenderSubCategory" [value]="sub.id">
                                                  {{ sub.tenderSubCategory }}
                                                </mat-option>
                                              </mat-optgroup>
                                            </mat-select>
                                          </mat-form-field>
                                        </div>
                                      </form> -->

                                      <!-- <form [formGroup]="categoryConfigurationForm">
                                        <div class="row">
                                       <div class="col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1"> </div>

                                        <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                                          <mat-form-field appearance="outline" style="width: 100%; height: 55px;">
                                              <mat-label>Category</mat-label>
                                              <mat-select multiple formControlName="selection" style="border: none;">
                                                <mat-option #allSelection (click)="toggleAllSelection('select')" [value]="0" >All category</mat-option>
                                                <mat-option *ngFor="let category of categoryList" [value]="category.id" (click)="tosslePerOne('select')">
                                                      {{category.tenderCategory}}
                                                  </mat-option>
                                              </mat-select>
                                          </mat-form-field>
                                      </div>
                                      <div class="col-1 col-sm-1 col-md-1 col-lg-1 col-xl-1"> </div>
                                    </div>
                                      </form> -->

                                      <!-- <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">

                                        <button mat-raised-button (click)="openNotificationDialog(notification)">Select category</button>
                                        
                                    </div> -->

                   <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                       <mat-form-field class="columns" appearance="outline"style="height: 15px;width:100%;">

                               <mat-label *ngIf="this.userDetails?.companyProfile && this.userDetails?.companyProfile != ''; else companyProfile">
                                   Company profile</mat-label>
                               <ng-template #companyProfile>
                                   <mat-label> {{ 'companyProfile' | translate }}
                                   </mat-label>
                               </ng-template>
                               <input matInput readonly [(ngModel)]="this.userDetails.companyProfile"
                                   [ngModelOptions]="{standalone: true}" style="width:100%;border-bottom: 0px;" >
                               <button mat-icon-button matSuffix *ngIf="!this.userDetails.companyProfile || this.userDetails.companyProfile=='' || this.userDetails.companyProfile==null"
                                   (click)="cmpPrFileInput.click()">
                                   <mat-icon>attach_file</mat-icon>
                               </button>
                               <button mat-icon-button matSuffix *ngIf="this.userDetails.companyProfile && this.userDetails.companyProfile!='' && this.userDetails.companyProfile!=null"
                                   (click)="removeCmpPrFile()">
                                   <mat-icon>delete_outline</mat-icon>
                               </button>
                               <input hidden (change)="uploadCmpPrFiles($event)"
                                   #cmpPrFileInput type="file" id="file" >
                           </mat-form-field>

                        </div>


                        <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10">
                            <mat-form-field class="columns" appearance="outline"style="height: 15px;margin-top: 25px;width:100%;">
     
                                    <mat-label *ngIf="this.userDetails?.projectCompletedCert && this.userDetails?.projectCompletedCert != ''; else projectCompletedCert">
                                       Project Completed certificate</mat-label>
                                    <ng-template #projectCompletedCert>
                                        <mat-label> {{ 'projectCompletedCert' | translate }}
                                        </mat-label>
                                    </ng-template>
                                    <input matInput readonly [(ngModel)]="this.userDetails.projectCompletedCert" style="width:100%;border-bottom: 0px;" 
                                        [ngModelOptions]="{standalone: true}">
                                    <button mat-icon-button matSuffix *ngIf="!this.userDetails.projectCompletedCert || this.userDetails.projectCompletedCert=='' || this.userDetails.projectCompletedCert==null"
                                        (click)="prCmpltCertFileInput.click()">
                                        <mat-icon>attach_file</mat-icon>
                                    </button>
                                    <button mat-icon-button matSuffix *ngIf="this.userDetails.projectCompletedCert && this.userDetails.projectCompletedCert!='' && this.userDetails.projectCompletedCert!=null"
                                        (click)="removeprCmpltCertFile()">
                                        <mat-icon>delete_outline</mat-icon>
                                    </button>
                                    <input hidden (change)="uploadprCmpltCertFiles($event)"
                                        #prCmpltCertFileInput type="file" id="file" >
                                </mat-form-field>
     
                             </div>
                                      
                             <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10" style="margin-top: 20px;">
                                <mat-form-field style="width: 100%" appearance="outline">
                                    <mat-label>maximum value of single project completed till date</mat-label>
                                    <input matInput [(ngModel)]="this.userDetails.maxAmount" type="number" placeholder="{{ 'maximum value of single project completed till date'| translate }}" style="width:100%;border-bottom: 0px;" >
                                </mat-form-field>
                            </div>
                                    <div class="col-10 col-sm-10 col-md-12 col-lg-10 col-xl-10"
                                        style="text-align: center;margin-top: 25px;">
                                        <button mat-raised-button (click)="saveData(notification)" class="saveButton">{{ 'save' | translate}}</button>
                                    </div>
                                </div>
                            </mat-card-content>
                        </mat-card>
                    </div>
                    <!-- <div class="col-sm-4"></div> -->
                </div>
            </div>
        </div>
    </div>

    <!-- <div class="footer" class="fixed-bottom">
        <footer id="footer" style="background-color: #48746e; padding: 70px 0; color: #ffffff; font-size: 16px; bottom: 0;" class="py-3">
          <div class="container">
            <div class="row">
              <div class="col-md-12 text-center">
                <p class="mb-0">&copy; <span style="font-weight: bolder;font-family: sans-serif;">Art . n Architects </span>All Rights Reserved</p>
                <p class="mb-0">Designed by <a href="https://www.simssoftware.in/" style="color: #ffffff;">SiMS</a></p>
              </div>
            </div>
          </div>
        </footer>
        </div> -->

    </div>

    <ng-template #notification>
        <h6>Select Category</h6>
      
      
      <div class="row">
          <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
            
            <div class="row">
             <div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4" style="padding: 0;">
              <mat-card style="min-width: 0;">
                <div class="row">
                    <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12" style="overflow: scroll;max-height: 43vh;">
      
                      <mat-card *ngFor="let category of categoryList;let i=index;" (click)="getSubcategory(category.id,i)" 
                      [ngClass]="{'background-color-blue': selectedCategoryId == category.id, 'background-color-white': !selectedCategoryId == category.id, 'color-white': selectedCategoryId == category.id, 'color-black': !selectedCategoryId == category.id}">
                      {{category.tenderCategory}}
                  </mat-card>
                  
      
                          
                    </div>
                </div>
               </mat-card>
             </div>
      
            
             <div class="col-12 col-sm-12 col-md-8 col-lg-8 col-xl-8" style="padding: 0;">
              <mat-card style="min-width: 0;">
                <div class="row">
                  <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12" style="overflow: scroll;max-height: 43vh;">
                      
                   <br>
      
                <div class="row" *ngFor="let subCategory of categoryList?.[selectedCategoryIndex]?.tenderSubCategory">
                  <div class="col-2 col-sm-2 col-md-2 col-lg-2 col-xl-2" 
                  style="display: flex;justify-content: center;align-items: center;">
      
                      <mat-checkbox [(ngModel)]="subCategory.selected" (change)="categoryChecked($event,subCategory,selectedCategoryIndex)" style="transform: scale(1.5);"></mat-checkbox>
      
                    </div>
                    <div class="col-10 col-sm-10 col-md-10 col-lg-10 col-xl-10" style="padding: 0;">
       
                          {{subCategory.tenderSubCategory}}
                      
                  </div>
                  
                  <br>
                  <br>
              </div>
      
      
            </div>
          </div>
               </mat-card>
             </div>
              
      
            </div>
      
      
        </div>
      </div>
        <!-- </form> -->
      
        <div class="row">
          <div class="col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6" style="text-align: center;">
            <button class="addButton" (click)="closeDialog()" mat-raised-button
              style="margin:auto;color: #a34040;background-color: #faf2f2;width: 80%;">Close</button>
          </div>
          <div class="col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6" style="text-align: center;">
      
            <button class="addButton" (click)="saveCategory()" mat-raised-button style="margin:auto;width: 80%;display: flex;align-items: center;justify-content: center;">
              <p style="margin-top: 15px;" *ngIf="!spinnerLoading">Save</p>
              <mat-spinner diameter="20" *ngIf="spinnerLoading"></mat-spinner>
            </button>
          </div>
        </div>
      
      
      </ng-template>