agregar-instu.component.html 7.87 KB
Newer Older
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 189 190 191 192 193 194 195 196 197 198
<!-- Importaciones necesarias -->
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />

<div class="contenedor">
  <div class="sobremontado">
    <span class="icono-instituciones material-icons">new_label</span>
    Agregar una Institución
    <button class="volver" (click)="volver()">
      <mat-icon>keyboard_arrow_left</mat-icon>
    </button>
  </div>
  <div class="contenedor-dos">
    <form [formGroup]="myForm" (ngSubmit)="onSubmit()" class="formulario">
      <!-- Información de la institución -->
      <div class="columna-izquierda">
        <div>
          <label for>
            <h2>Datos de la Institución</h2>
          </label>
        </div>
        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Nombre de la Institución</mat-label>
            <input matInput formControlName="nombreFormControl" required>
            <mat-error *ngIf="myForm.get('nombreFormControl').invalid && (myForm.get('nombreFormControl').dirty 
            || myForm.get('nombreFormControl').touched)">
              Por favor, ingrese un nombre valido.
            </mat-error>
          </mat-form-field>
        </div>

        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Seleccione una Provincia</mat-label>
            <mat-select formControlName="provincia" required [(ngModel)]="selectedProvincia"
              (ngModelChange)="obtenerCantones($event?.uzytprovincia_id)">

              <mat-option *ngFor="let provincia of provincia" [value]="provincia">
                {{ provincia.uzytprovincia_nombre }}
              </mat-option>

            </mat-select>

            <mat-error *ngIf="myForm.get('provincia').invalid && (myForm.get('provincia').dirty 
            || myForm.get('provincia').touched)">
              Por favor, ingrese un nombre valido.
            </mat-error>
          </mat-form-field>
        </div>
        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Seleccione un Canton</mat-label>

            <mat-select formControlName="canton" required [(ngModel)]="selectedCanton"
              (ngModelChange)="obtenerParroquias($event?.uzytcanton_id)">

              <mat-option *ngFor="let canton of canton" [value]="canton">
                {{ canton.uzytcantonnombre }}
              </mat-option>

            </mat-select>

            <mat-error *ngIf="myForm.get('canton').invalid && (myForm.get('canton').dirty 
            || myForm.get('canton').touched)">
              Por favor, ingrese un nombre valido.
            </mat-error>
          </mat-form-field>
        </div>
        <div>

          <mat-form-field class="example-full-width">
            <mat-label>Parroquia</mat-label>
            <mat-select formControlName="parroquia" required [(ngModel)]="selectedParroquiaId" [disabled]="!selectedCanton">
              <mat-option *ngFor="let parroquia of parroquia" [value]="parroquia.uzytparroquia_id">
                {{ parroquia.uzytparroquia_nombre }}
              </mat-option>
            </mat-select>
            
            <mat-error *ngIf="myForm.get('parroquia').invalid && (myForm.get('parroquia').dirty 
            || myForm.get('parroquia').touched)">
              Por favor, ingrese un nombre valido.
            </mat-error>
          </mat-form-field>
          
        </div>
        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Dirección</mat-label>
            <input matInput formControlName="direccionFormControl" required>
            <mat-error *ngIf="myForm.get('direccionFormControl').invalid && 
            (myForm.get('direccionFormControl').dirty 
            || myForm.get('direccionFormControl').touched)">
              Por favor, ingrese una Dirección valida.
            </mat-error>
          </mat-form-field>
        </div>

        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Telefono</mat-label>
            <input matInput formControlName="telefonoFormControl" required pattern="[0-9]+">
            <mat-error *ngIf="myForm.get('telefonoFormControl').invalid && 
            (myForm.get('telefonoFormControl').dirty 
            || myForm.get('telefonoFormControl').touched)">
              Por favor, ingrese una Dirección valida.
            </mat-error>
          </mat-form-field>
        </div>
      </div>

      <!-- Información del representante -->
      <div class="columna-derecha">

        <div>
          <label for>
            <h2>Información del Representante</h2>
          </label>
        </div>
        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Nombre del Representante</mat-label>
            <input matInput formControlName="nombreRepeFormControl" required>
            <mat-error *ngIf="myForm.get('nombreRepeFormControl').invalid && 
            (myForm.get('nombreRepeFormControl').dirty 
            || myForm.get('nombreRepeFormControl').touched)">
              Por favor, ingrese un nombre valido.
            </mat-error>
          </mat-form-field>
        </div>

        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Apellido del Representante</mat-label>
            <input matInput formControlName="apellidoRepre" required>
            <mat-error *ngIf="myForm.get('apellidoRepre').invalid && 
            (myForm.get('apellidoRepre').dirty 
            || myForm.get('apellidoRepre').touched)">
              Por favor, ingrese un apellido valido.
            </mat-error>
          </mat-form-field>
        </div>

        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Cargo del Representante</mat-label>
            <input matInput formControlName="cargoRepre" required>
            <mat-error *ngIf="myForm.get('cargoRepre').invalid && 
            (myForm.get('cargoRepre').dirty 
            || myForm.get('cargoRepre').touched)">
              Por favor, ingrese un cargo valido.
            </mat-error>
          </mat-form-field>
        </div>
        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Telefono del Representante</mat-label>
            <input matInput formControlName="telefonoRepreFormControl" required pattern="[0-9]+">
            <mat-error *ngIf="myForm.get('telefonoRepreFormControl').invalid && 
            (myForm.get('telefonoRepreFormControl').dirty 
            || myForm.get('telefonoRepreFormControl').touched)">
              Por favor, ingrese un teléfono valido.
            </mat-error>
          </mat-form-field>
        </div>

        <div>
          <mat-form-field class="example-full-width">
            <mat-label>Email del Representante</mat-label>
            <input matInput formControlName="emailRepreFormControl" required>
            <mat-error *ngIf="myForm.get('emailRepreFormControl').invalid && 
            (myForm.get('emailRepreFormControl').dirty 
            || myForm.get('emailRepreFormControl').touched)">
              Por favor, ingrese un teléfono valido.
            </mat-error>
          </mat-form-field>
        </div>

        <div class="input-container">
          <mat-form-field>
            <mat-label>Fecha:</mat-label>
            <input matInput [matDatepicker]="picker" placeholder="Seleccione una fecha"
              formControlName="fechaConfiguracion" required>
            <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
            <mat-datepicker #picker></mat-datepicker>
          </mat-form-field>
        </div>
        <div>
          <label for="direccion">Estado:</label>
          <mat-checkbox formControlName="activo">Activo</mat-checkbox>
        </div>
      </div>

      <button mat-raised-button color="primary" [disabled]="myForm.invalid" >Guardar</button>
    </form>
  </div>

</div>