IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Angular Discussion :

Envoie de donnée de formulaire


Sujet :

Angular

  1. #1
    Membre du Club
    Femme Profil pro
    Développeur Web
    Inscrit en
    Mars 2021
    Messages
    82
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2021
    Messages : 82
    Points : 43
    Points
    43
    Par défaut Envoie de donnée de formulaire
    Bonjour,

    j'ai un très gros formulaire avec un affichage dynamique et des pseudo button (que j'ai transformé en a car cç planter tout le temps au milieu de mon formulaire).

    Mon problème est que lorsque que je clique sur le button de validation il y 2 choses

    la première j'ai cette erreur

    core.js:4197 ERROR TypeError: Cannot read property 'substr' of null
    et la deuxième est qu'il ne passe aucune action, c'est à dire que j'essaye de faire un console.log(newBooking): pour voir les données que j'envoie. mais le console.log() ne s'affiche pas


    Code TypeScript : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
     
      hoursBookings: HoursBooking[];
      hoursBookingSubscription: Subscription;
      dateForth: any;
      hoursForth: any;
      hoursBack: any;
      dateBack: any;
      p: number = 1;
      p2: number = 1;
     
      siv: Siv[];
      bookingForm: FormGroup;
      bookings: Booking[];
      bookingSubscription: Subscription;
      address: any;
      addressForth: any;
      addressBack: any;
      distance: number;
      distanceForth: number;
      distanceBack: number;
      durationForth: number;
      durationBack: number;
      tarif: any;
      testTarif: any;
      formulaBooking: any;
      DistanceBooking: any[];
      addressPartner = JSON.parse(localStorage.getItem('addressPartner'));
      customers: Customer[];
      customerSubscription: Subscription;
      modelCar: any;
      brandCar: any;
      dateOfCirculationCar: any;
      motorizationCar: any;
      versionCar: any;
      colorCar: any;
     
     
      constructor(private bookingService: BookingService, private router: Router, private formBuilder: FormBuilder, private partnerService: PartnerService, private ngZone: NgZone, private  mapService: MapService, private customerService: CustomerService, private sivService: SivService, private hoursBookingService: HoursBookingService) { }
     
      ngOnInit(): void {
        this.bookingForm = this.formBuilder.group({
          addressForth: [''],
          addressBack: [''],
          address: [''],
          formulaBooking: [''],
          firstNameCustomer: [''],
          lastNameCustomer: [''],
          mailCustomer: [''],
          phoneCustomer: [''],
          dateOfBirthdayCustomer: [''],
          addressBilling: [''],
          licensePlateCar: [''],
          modelCar: [''],
          brandCar: [''],
          colorCar: [''],
          versionCar: [''],
          motorizationCar: [''],
          dateOfCirculationCar: [''],
          hoursForth: [''],
          hoursBack: ['']
        });
        this.customerSubscription = this.customerService.customerSubject.subscribe(
          (customers: Customer[]) => {
            this.customers = customers;
          }
        );
        this.customerService.readlListCustomer();
        this.hoursBookingSubscription = this.hoursBookingService.hoursBookingSubject.subscribe(
          (hoursBookings: HoursBooking[]) => {
            this.hoursBookings = hoursBookings;
          }
        );
        this.hoursBookingService.readListHoursBooking();
        this.initAutocomplete();
      }
     
      changeFormulaBooking(e) {
      }
     
      initAutocomplete() {
        let autocomplete = new google.maps.places.Autocomplete(document.getElementById('address') as HTMLInputElement);
        autocomplete.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux
            let place: google.maps.places.PlaceResult = autocomplete.getPlace();
            // console.log('place is ', place);
            // this.form.address1 = place.formatted_address;
            this.address = place.formatted_address
            //console.log('address 1 ', this.form.address1);
            this.bookingForm.patchValue({
              address : this.address
            });
            //verify result
            if (place.geometry === undefined || place.geometry === null) {
              return;
            }
          });
        });
        let autocomplete2 = new google.maps.places.Autocomplete(document.getElementById('addressForth1') as HTMLInputElement);
        autocomplete2.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux de l'address 2
            let place2: google.maps.places.PlaceResult = autocomplete2.getPlace();
            this.addressForth = place2.formatted_address
            // console.log('pickup ', this.form.pickupLocation);
            this.bookingForm.patchValue({
              addressForth : this.addressForth || "",
              addressBack: this.addressBack
            });
            //verify result
            if (place2.geometry === undefined || place2.geometry === null) {
              return;
            }
          });
        });
        let autocomplete3 = new google.maps.places.Autocomplete(document.getElementById('addressBack1') as HTMLInputElement);
        autocomplete3.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux de l'address 2
            let place3: google.maps.places.PlaceResult = autocomplete3.getPlace();
            this.addressBack = place3.formatted_address
            // console.log('pickup ', this.form.pickupLocation);
            this.bookingForm.patchValue({
              addressForth : this.addressForth || "",
              addressBack: this.addressBack
            });
            //verify result
            if (place3.geometry === undefined || place3.geometry === null) {
              return;
            }
          });
        });
      }
     
      getDist(): Promise<any>{
        this.formulaBooking = this.bookingForm.value.formulaBooking;
        if (this.bookingForm.value.address !== '') {
          return this.mapService.calculerDistance(this.address, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'forth') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceForth, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 1 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 1 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressForth = this.bookingForm.value.address;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 1 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressForth = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 1 addressForth',this.addressForth);
              // console.log('compenent condition 1 addressBack',this.addressBack);
              // console.log('compenent condition 1 component distanceForth', this.distanceForth);
              // console.log('compenent condition 1 component  durationForth', this.durationForth);
              // console.log('compenent condition 1 component distanceBack', this.distanceBack);
              // console.log('compenent condition 1 component  durationBack', this.durationBack);
              // console.log('component constion 1 formula', this.formulaBooking);
              // console.log('component constion 1 tarif',this.tarif);
              // console.log('compenent condition 1 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 1 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 1 local address', localStorage.removeItem('address'));
              // this.addressForth = "";
              // this.distanceForth = 0;
              // this.durationForth = 0;
              this.rebuilderForm();
            }
            else if (this.formulaBooking === 'back') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceBack, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.address;
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
              // this.addressBack = "";
              // this.distanceBack = 0;
              // this.durationBack = 0;
              this.rebuilderForm();
            }
          });
        }
        else if (this.bookingForm.value.addressForth !== '' && this.bookingForm.value.addressBack !== '') {
          this.mapService.calculerDistance(this.addressForth, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'round') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 1 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 1 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressForth = this.bookingForm.value.addressForth;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 1 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressForth = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 1 addressForth',this.addressForth);
              // console.log('compenent condition 1 addressBack',this.addressBack);
              // console.log('compenent condition 1 component distanceForth', this.distanceForth);
              // console.log('compenent condition 1 component  durationForth', this.durationForth);
              // console.log('compenent condition 1 component distanceBack', this.distanceBack);
              // console.log('compenent condition 1 component  durationBack', this.durationBack);
              // console.log('component constion 1 formula', this.formulaBooking);
              // console.log('component constion 1 tarif',this.tarif);
              // console.log('compenent condition 1 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 1 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 1 local address', localStorage.removeItem('address'));
            }
            else if (this.formulaBooking === 'technicalControl') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceForth, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressForth;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceForth);
              // console.log('compenent condition 2 component  durationBack', this.durationForth);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
            }
          });
          this.mapService.calculerDistance(this.addressBack, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'round') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressBack;
              this.tarif = this.mapService.calculTarifThreeAddress(this.distanceForth, this.distanceBack, this.formulaBooking);
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressBack = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
              // this.addressForth = '';
              // this.addressBack = '';
              // this.distanceForth = 0;
              // this.durationForth = 0;
              // this.distanceBack = 0;
              // this.durationBack = 0;
              this.rebuilderForm();
            }
            else if (this.formulaBooking === 'technicalControl') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceBack, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressBack;
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
            }
          });
     
        }
      }
     
      getCar() {
        const formValue = this.bookingForm.value;
        const newSiv = new Siv(
          formValue['licensePlateCar']
        );
        return this.sivService.addSIV(newSiv).then((data) => {
          this.modelCar = data.modelCar;
          this.bookingForm.controls['modelCar'].setValue(this.modelCar);
          this.brandCar = data.brandCar;
          this.bookingForm.controls['brandCar'].setValue(this.brandCar);
          this.dateOfCirculationCar = data.dateOfCirculationCar;
          this.bookingForm.controls['dateOfCirculationCar'].setValue(this.dateOfCirculationCar);
          this.colorCar = data.colorCar;
          this.bookingForm.controls['colorCar'].setValue(this.colorCar);
          this.versionCar = data.versionCar;
          this.bookingForm.controls['versionCar'].setValue(this.versionCar);
          this.motorizationCar = data.motorizationCar;
          this.bookingForm.controls['motorizationCar'].setValue(this.motorizationCar);
          console.log(this.colorCar);
          return data;
        });
      }
     
      onSubmitFormBooking(): void {
        const formValue = this.bookingForm.value;
        const newBooking = new Booking ();
        newBooking.addressForth = this.bookingForm.value.addressForth;
        newBooking.addressPartner = this.bookingForm.value.addressPartner;
        newBooking.addressBack = this.bookingForm.value.addressBack;
        newBooking.durationForth = this.bookingForm.value.durationForth;
        newBooking.distanceForth = this.bookingForm.value.distanceForth;
        newBooking.distanceBack = this.bookingForm.value.distanceBack;
        newBooking.durationBack = this.bookingForm.value.durationBack;
        newBooking.formulaBooking = this.bookingForm.value.formulaBooking;
        newBooking.firstNameCustomer = this.bookingForm.value.firstNameCustomer;
        newBooking.lastNameCustomer = this.bookingForm.value.lastNameCustomer;
        newBooking.mailCustomer = this.bookingForm.value.mailCustomer;
        newBooking.phoneCustomer = this.bookingForm.value.phoneCustomer;
        newBooking.dateOfBirthdayCustomer = this.bookingForm.value.dateOfBirthdayCustomer;
        newBooking.priceBooking = this.bookingForm.value.tarif;
        newBooking.licensePlateCar = this.bookingForm.value.licensePlateCar;
        newBooking.modelCar = this.bookingForm.value.modelCar;
        newBooking.brandCar = this.bookingForm.value.brandCar;
        newBooking.dateOfBirthdayCustomer = this.bookingForm.value.dateOfCirculationCar;
        newBooking.colorCar = this.bookingForm.value.colorCar;
        newBooking.versionCar = this.bookingForm.value.versionCar;
        newBooking.motorizationCar = this.bookingForm.value.motorizationCar;
        newBooking.dateForth = this.bookingForm.get('hoursForth').value.substr(6, 16);
        newBooking.hoursForth = this.bookingForm.get('hoursForth').value.substr(0, 5);
        newBooking.dateBack = this.bookingForm.get('hoursBack').value.substr(6, 16);
        newBooking.hoursBack = this.bookingForm.get('hoursBack').value.substr(0, 5);
        console.log('envoie donnée', newBooking);
      }
     
      rebuilderForm(){
        this.bookingForm.reset(
          {
            address: '',
            addressForth: '',
            addressBack: '',
            addressBilling: ''
          }
        );
      }

    le html
    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
     
    <div class="row mt-5 mb-5">
      <div class="col-12 text-center">
          <h2>Prendre un rendez-vous</h2>
      </div>
    </div>
     
    <div class="row">
      <form class="col-10 offset-1" [formGroup]="bookingForm" (ngSubmit)="onSubmitFormBooking()">
        <div class="row">
          <div class="col-6">
            <h3 class="text-center mb-4">Choix de la formule</h3>
          </div>
        </div>
        <div class="row d-flex">
          <div class="mb-3 col-6">
            <div class="row input-field d-flex flex-row mb-2">
              <div class="input-field d-flex mt-radio flex-colunm col-7">
                      <p class="d-flex flex-row">
                        <input name="formulaBooking" type="radio" value="simple" class="validate m-auto" id="simple" formControlName="formulaBooking" (change)="changeFormulaBooking($event)">
                        <label for="formulaBooking">Trajet simple</label>
                      </p>
              </div>
              <div class="input-field d-flex mt-radio flex-colunm col-5">
                      <p class="d-flex flex-row">
                        <input name="formulaBooking" type="radio" value="round" class="validate m-auto" id="round" formControlName="formulaBooking" (change)="changeFormulaBooking($event)">
                        <label for="formulaBooking">Aller/Retour</label>
                      </p>
              </div>
            </div>
            <div class="row input-field d-flex flex-row mb-2" *ngIf="this.bookingForm.value.formulaBooking === 'simple' || this.bookingForm.value.formulaBooking === 'forth' || this.bookingForm.value.formulaBooking === 'back' ">
              <div class="input-field d-flex mt-radio flex-colunm">
                <label class="col-4 mr-0" for="formulaBooking">Type de trajet</label>
                <select class="validate col-8" id="formulaBooking" formControlName="formulaBooking" required>
                  <option value="Selectionnez un type de trajet" disabled selected>Sélectionnez un type de trajet</option>
                  <option value="forth" (change)="changeFormulaBooking($event)">Prise en charge</option>
                  <option value="back" (change)="changeFormulaBooking($event)">Restitution</option>
                </select>
              </div>
            </div>
          </div>
          <div class="mb-3 col-6" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'forth' && this.bookingForm.value.formulaBooking != 'back'}">
            <div class="input-field d-flex flex-row mb-70">
              <div class="input-field col-12">
                <div class="label" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'forth'}">
                  <label for="address" >Adresse de prise en charge</label>
                </div>
                <div class="label" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'back'}">
                  <label for="address" >Adresse de restitution</label>
                </div>
                <input type="text" class="validate" id="address" formControlName="address">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
          </div>
          <div class="mb-3 col-6" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'round'}">
            <div class="input-field d-flex flex-row mb-70">
              <div class="input-field col-12">
                <label for="addressForth">Adresse de prise en charge</label>
                <input type="text" class="validate" id="addressForth1" formControlName="addressForth">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="addressBack">Adresse de restitution</label>
                <input type="text" class="validate" id="addressBack1" formControlName="addressBack">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
          </div>
        </div>
        <div class="row d-flex mb-5">
          <div class="input-field text-center m-auto">
            <a class="m-auto size" id="btn" (click)="getDist()">Tarif</a>
          </div>
          <div class="input-field text-center" *ngIf="this.tarif != undefined && this.tarif != 'nous contacter'">
            <h3>Le tarif de la prestation est de {{ tarif }}</h3>
          </div>
          <div class="input-field text-center" *ngIf="this.tarif === 'nous contacter'">
            <h3><strong>Distance trop importante trajet indisponible</strong></h3>
          </div>
        </div>
     
        <div class="row d-flex">
          <div class="col-6 colInfoLeft" *ngIf="this.tarif != undefined && this.tarif != 'nous contacter' ">
            <h3 class="text-center mb-4">Information client</h3>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6">
                <label for="firstNameCustomer">Nom du client</label>
                <input required type="text" class="validate" id="firstNameCustomer" formControlName="firstNameCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
              <div class="input-field col-6">
                <label for="lastNameCustomer">Prénom du client</label>
                <input required type="text" class="validate" id="lastNameCustomer" formControlName="lastNameCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6">
                <label for="phoneCustomer">Téléphone du client</label>
                <input required type="text" class="validate" id="phoneCustomer" formControlName="phoneCustomer">
                <!-- <div class="messageError">
                  <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
              <div class="input-field col-6">
                <label for="mailCustomer">E-mail</label>
                <input type="text" class="validate" id="mailCustomer" formControlName="mailCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="dateOfBirthdayCustomer">Date de naissance du client</label>
                <input type="date" class="validate" id="dateOfBirthdayCustomer" formControlName="dateOfBirthdayCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <h3 class="text-center mb-4 mt-4">Information véhicule</h3>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="licensePlateCar">Plaque d'immatriculation</label>
                <input required type="text" class="validate" id="licensePlateCar" formControlName="licensePlateCar">
                <!-- <div class="messageError">
                  <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="mt-5 mb-5 text-center">
              <a class="m-auto size" id="btn" (click)="getCar()">Valider la plaque</a>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6"*ngIf="this.brandCar != null" >
                <label for="brandCar">Marque</label>
                <input required type="text" class="validate" id="brandCar" formControlName="brandCar">
              </div>
              <div class="input-field col-6" *ngIf="this.modelCar != null">
                <label for="modelCar">Modèle</label>
                <input required type="text" class="validate" id="modelCar" formControlName="modelCar">
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6" *ngIf="this.dateOfCirculationCar != null">
                <label for="dateOfCirculationCar">Date de mise en circulation</label>
                <input required type="text" class="validate" id="dateOfCirculationCar" formControlName="dateOfCirculationCar">
              </div>
              <div class="input-field col-6" *ngIf="this.motorizationCar != null">
                <label for="motorizationCar">Motorisation</label>
                <input required type="text" class="validate" id="motorizationCar" formControlName="motorizationCar">
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6" *ngIf="this.colorCar != null">
                <label for="colorCar">Couleur</label>
                <input required type="text" class="validate" id="colorCar" formControlName="colorCar">
              </div>
              <div class="input-field col-6" *ngIf="this.versionCar != null">
                <label for="versionCar">Version</label>
                <input required type="text" class="validate" id="versionCar" formControlName="versionCar">
              </div>
            </div>
          </div>
          <div class="col-6 text-center" >
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <h3 class="text-center m-auto mb-4">Créneau de prise en charge</h3>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <pagination-controls id='pagination1' class="hide-page-numbers m-auto" (pageChange)="p = $event" previousLabel="prec" nextLabel="suiv"></pagination-controls>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center"*ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination1', itemsPerPage: 3, currentPage: p }">
                <p class="hoursBooking">{{ hoursBooking.datebookingCalendar }}</p>
              </div>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center" *ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination1', itemsPerPage: 3, currentPage: p }">
                <div class="radio-group">
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h1bookingCalendar" id="h1Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h1Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">07:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h2bookingCalendar" id="h2Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h2Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">08:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h3bookingCalendar" id="h3Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h3Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">09:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h4bookingCalendar" id="h4Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h4Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">10:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h5bookingCalendar" id="h5Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h5Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">11:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h6bookingCalendar" id="h6Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h6Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">13:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h7bookingCalendar" id="h7Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h7Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">14:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h8bookingCalendar" id="h8Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h8Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">15:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h9bookingCalendar" id="h9Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h9Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">16:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h10bookingCalendar" id="h10Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h10Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">17:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h11bookingCalendar" id="h11Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h11Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">18:30</label>
                </div>
              </div>
            </div>
     
            <div class="row sepHoursBooking" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <h3 class="text-center m-auto title">Créneau de restitution</h3>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <pagination-controls id='pagination2' class="hide-page-numbers m-auto" (pageChange)="p2 = $event" previousLabel="prec" nextLabel="suiv"></pagination-controls>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center"*ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination2', itemsPerPage: 3, currentPage: p2 }">
                <p class="hoursBooking">{{ hoursBooking.datebookingCalendar }}</p>
              </div>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center" *ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination2', itemsPerPage: 3, currentPage: p2 }">
                <div class="radio-group">
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h1bookingCalendar" id="h1Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h1Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">07:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h2bookingCalendar" id="h2Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h2Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">08:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h3bookingCalendar" id="h3Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h3Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">09:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h4bookingCalendar" id="h4Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h4Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">10:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h5bookingCalendar" id="h5Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h5Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">11:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h6bookingCalendar" id="h6Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h6Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">13:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h7bookingCalendar" id="h7Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h7Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">14:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h8bookingCalendar" id="h8Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h8Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">15:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h9bookingCalendar" id="h9Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h9Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">16:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h10bookingCalendar" id="h10Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h10Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">17:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h11bookingCalendar" id="h11Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h11Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">18:30</label>
                </div>
              </div>
            </div>
     
          </div>
          <div class="col-12 mt-5 mb-5 text-center">
            <button class="m-auto" id="btn" type="submit">Ajouter un rendez-vous</button>
          </div>
        </div>
      </form>
    </div>

  2. #2
    Membre du Club
    Femme Profil pro
    Développeur Web
    Inscrit en
    Mars 2021
    Messages
    82
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2021
    Messages : 82
    Points : 43
    Points
    43
    Par défaut
    j'ai trouvé la solution voici mon code si ca peut aider des personnes

    Code TypeScript : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    import { Component, OnInit, NgZone } from '@angular/core';
    import { BookingService } from 'src/app/services/booking.service';
    import { FormBuilder, FormGroup, Validators } from '@angular/forms';
    import { Subscription } from 'rxjs';
    import { Router } from '@angular/router';
    import { PartnerService } from 'src/app/services/partner.service';
    import { MapService } from 'src/app/services/map.service';
    import { Booking } from 'src/app/models/booking.model';
    import {  } from 'rxjs/add/operator/toPromise';
    import { CustomerService } from 'src/app/services/customer.service';
    import { Customer } from 'src/app/models/customer.model';
    import { SivService } from 'src/app/services/siv.service';
    import { first } from 'rxjs/operators';
    import { Siv } from 'src/app/models/siv.model';
    import { HoursBooking } from 'src/app/models/hoursBooking.model';
    import { HoursBookingService } from 'src/app/services/hours-booking.service';
     
    @Component({
      selector: 'app-booking-forms',
      templateUrl: './booking-forms.component.html',
      styleUrls: ['./booking-forms.component.css']
    })
    export class BookingFormsComponent implements OnInit {
     
      hoursBookings: HoursBooking[];
      hoursBookingSubscription: Subscription;
      dateForth: any;
      hoursForth: any;
      hoursBack: any;
      dateBack: any;
      p: number = 1;
      p2: number = 1;
     
      siv: Siv[];
      bookingForm: FormGroup;
      bookings: Booking[];
      bookingSubscription: Subscription;
      address: any;
      addressForth: any;
      addressBack: any;
      distance: number;
      distanceForth: number;
      distanceBack: number;
      durationForth: number;
      durationBack: number;
      tarif: any;
      testTarif: any;
      formulaBooking: any;
      DistanceBooking: any[];
      addressPartner = JSON.parse(localStorage.getItem('addressPartner'));
      customers: Customer[];
      customerSubscription: Subscription;
      modelCar: any;
      brandCar: any;
      dateOfCirculationCar: any;
      motorizationCar: any;
      versionCar: any;
      colorCar: any;
     
     
      constructor(private bookingService: BookingService, private router: Router, private formBuilder: FormBuilder, private partnerService: PartnerService, private ngZone: NgZone, private  mapService: MapService, private customerService: CustomerService, private sivService: SivService, private hoursBookingService: HoursBookingService) { }
     
      ngOnInit(): void {
        this.bookingForm = this.formBuilder.group({
          addressForth: [''],
          addressBack: [''],
          address: [''],
          formulaBooking: [''],
          firstNameCustomer: [''],
          lastNameCustomer: [''],
          mailCustomer: [''],
          phoneCustomer: [''],
          dateOfBirthdayCustomer: [''],
          addressBilling: [''],
          licensePlateCar: [''],
          modelCar: [''],
          brandCar: [''],
          colorCar: [''],
          versionCar: [''],
          motorizationCar: [''],
          dateOfCirculationCar: [''],
          hoursForth: [''],
          hoursBack: ['']
        });
        this.customerSubscription = this.customerService.customerSubject.subscribe(
          (customers: Customer[]) => {
            this.customers = customers;
          }
        );
        this.customerService.readlListCustomer();
        this.hoursBookingSubscription = this.hoursBookingService.hoursBookingSubject.subscribe(
          (hoursBookings: HoursBooking[]) => {
            this.hoursBookings = hoursBookings;
          }
        );
        this.hoursBookingService.readListHoursBooking();
        this.initAutocomplete();
      }
     
      changeFormulaBooking(e) {
      }
     
      initAutocomplete() {
        let autocomplete = new google.maps.places.Autocomplete(document.getElementById('address') as HTMLInputElement);
        autocomplete.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux
            let place: google.maps.places.PlaceResult = autocomplete.getPlace();
            // console.log('place is ', place);
            // this.form.address1 = place.formatted_address;
            this.address = place.formatted_address
            //console.log('address 1 ', this.form.address1);
            this.bookingForm.patchValue({
              address : this.address
            });
            //verify result
            if (place.geometry === undefined || place.geometry === null) {
              return;
            }
          });
        });
        let autocomplete2 = new google.maps.places.Autocomplete(document.getElementById('addressForth1') as HTMLInputElement);
        autocomplete2.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux de l'address 2
            let place2: google.maps.places.PlaceResult = autocomplete2.getPlace();
            this.addressForth = place2.formatted_address
            // console.log('pickup ', this.form.pickupLocation);
            this.bookingForm.patchValue({
              addressForth : this.addressForth || "",
              addressBack: this.addressBack
            });
            //verify result
            if (place2.geometry === undefined || place2.geometry === null) {
              return;
            }
          });
        });
        let autocomplete3 = new google.maps.places.Autocomplete(document.getElementById('addressBack1') as HTMLInputElement);
        autocomplete3.addListener("place_changed", () => {
          this.ngZone.run(() => {
            //retrouver les lieux de l'address 2
            let place3: google.maps.places.PlaceResult = autocomplete3.getPlace();
            this.addressBack = place3.formatted_address
            // console.log('pickup ', this.form.pickupLocation);
            this.bookingForm.patchValue({
              addressForth : this.addressForth || "",
              addressBack: this.addressBack
            });
            //verify result
            if (place3.geometry === undefined || place3.geometry === null) {
              return;
            }
          });
        });
      }
     
      getDist(): Promise<any>{
        this.formulaBooking = this.bookingForm.value.formulaBooking;
        if (this.bookingForm.value.address !== '') {
          return this.mapService.calculerDistance(this.address, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'forth') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceForth, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 1 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 1 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressForth = this.bookingForm.value.address;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 1 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressForth = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 1 addressForth',this.addressForth);
              // console.log('compenent condition 1 addressBack',this.addressBack);
              // console.log('compenent condition 1 component distanceForth', this.distanceForth);
              // console.log('compenent condition 1 component  durationForth', this.durationForth);
              // console.log('compenent condition 1 component distanceBack', this.distanceBack);
              // console.log('compenent condition 1 component  durationBack', this.durationBack);
              // console.log('component constion 1 formula', this.formulaBooking);
              // console.log('component constion 1 tarif',this.tarif);
              // console.log('compenent condition 1 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 1 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 1 local address', localStorage.removeItem('address'));
              // this.addressForth = "";
              // this.distanceForth = 0;
              // this.durationForth = 0;
              this.rebuilderForm();
            }
            else if (this.formulaBooking === 'back') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceBack, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.address;
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
              // this.addressBack = "";
              // this.distanceBack = 0;
              // this.durationBack = 0;
              this.rebuilderForm();
            }
          });
        }
        else if (this.bookingForm.value.addressForth !== '' && this.bookingForm.value.addressBack !== '') {
          this.mapService.calculerDistance(this.addressForth, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'round') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 1 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 1 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressForth = this.bookingForm.value.addressForth;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 1 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressForth = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 1 addressForth',this.addressForth);
              // console.log('compenent condition 1 addressBack',this.addressBack);
              // console.log('compenent condition 1 component distanceForth', this.distanceForth);
              // console.log('compenent condition 1 component  durationForth', this.durationForth);
              // console.log('compenent condition 1 component distanceBack', this.distanceBack);
              // console.log('compenent condition 1 component  durationBack', this.durationBack);
              // console.log('component constion 1 formula', this.formulaBooking);
              // console.log('component constion 1 tarif',this.tarif);
              // console.log('compenent condition 1 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 1 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 1 local address', localStorage.removeItem('address'));
            }
            else if (this.formulaBooking === 'technicalControl') {
              this.distanceForth = data.distance;
              this.durationForth = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceForth, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressForth;
              localStorage.setItem('address', JSON.stringify(this.addressForth));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceForth);
              // console.log('compenent condition 2 component  durationBack', this.durationForth);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
            }
          });
          this.mapService.calculerDistance(this.addressBack, this.addressPartner)
          .then((data) => {
            if (this.formulaBooking === 'round') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressBack;
              this.tarif = this.mapService.calculTarifThreeAddress(this.distanceForth, this.distanceBack, this.formulaBooking);
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // localStorage.setItem('addressBack', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 1 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              this.addressBack = JSON.parse(localStorage.getItem('address'));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
              // this.addressForth = '';
              // this.addressBack = '';
              // this.distanceForth = 0;
              // this.durationForth = 0;
              // this.distanceBack = 0;
              // this.durationBack = 0;
              this.rebuilderForm();
            }
            else if (this.formulaBooking === 'technicalControl') {
              this.distanceBack = data.distance;
              this.durationBack = data.duration;
              this.tarif = this.mapService.calculTarifTwoAddress(this.distanceBack, this.formulaBooking);
              localStorage.setItem('tarif', JSON.stringify(this.tarif));
              // console.log('compenent condition 2 service distance', JSON.parse(localStorage.getItem('distance')));
              // console.log('compenent condition 2 service duration', JSON.parse(localStorage.getItem('duration')));
              this.addressBack = this.bookingForm.value.addressBack;
              localStorage.setItem('address', JSON.stringify(this.addressBack));
              // console.log('compenent condition 2 local addressForth', JSON.parse(localStorage.getItem('addressForth')));
              // console.log('compenent condition 2 local addressBack', JSON.parse(localStorage.getItem('addressBack')));
              // console.log('compenent condition 2 addressForth',this.addressForth);
              // console.log('compenent condition 2 addressBack',this.addressBack);
              // console.log('compenent condition 2 component distanceForth', this.distanceForth);
              // console.log('compenent condition 2 component  durationForth', this.durationForth);
              // console.log('compenent condition 2 component distanceBack', this.distanceBack);
              // console.log('compenent condition 2 component  durationBack', this.durationBack);
              // console.log('component constion 2 formula', this.formulaBooking);
              // console.log('component constion 2 tarif',this.tarif);
              // console.log('compenent condition 2 local distance', localStorage.removeItem('distance'));
              // console.log('compenent condition 2 local duration', localStorage.removeItem('duration'));
              // console.log('compenent condition 2 local address', localStorage.removeItem('address'));
            }
          });
     
        }
      }
     
      getCar() {
        const formValue = this.bookingForm.value;
        const newSiv = new Siv(
          formValue['licensePlateCar']
        );
        return this.sivService.addSIV(newSiv).then((data) => {
          this.modelCar = data.modelCar;
          this.bookingForm.controls['modelCar'].setValue(this.modelCar);
          this.brandCar = data.brandCar;
          this.bookingForm.controls['brandCar'].setValue(this.brandCar);
          this.dateOfCirculationCar = data.dateOfCirculationCar;
          this.bookingForm.controls['dateOfCirculationCar'].setValue(this.dateOfCirculationCar);
          this.colorCar = data.colorCar;
          this.bookingForm.controls['colorCar'].setValue(this.colorCar);
          this.versionCar = data.versionCar;
          this.bookingForm.controls['versionCar'].setValue(this.versionCar);
          this.motorizationCar = data.motorizationCar;
          this.bookingForm.controls['motorizationCar'].setValue(this.motorizationCar);
          console.log(this.colorCar);
          return data;
        });
      }
     
      onSubmitFormBooking(): void {
        const formValue = this.bookingForm.value;
        const newBooking = new Booking ();
        newBooking.addressForth = this.addressForth;
        newBooking.addressPartner = this.addressPartner;
        newBooking.addressBack = this.addressBack;
        newBooking.durationForth = this.durationForth;
        newBooking.distanceForth = this.distanceForth;
        newBooking.distanceBack = this.distanceBack;
        newBooking.durationBack = this.durationBack;
        newBooking.formulaBooking = this.formulaBooking;
        newBooking.firstNameCustomer = this.bookingForm.value.firstNameCustomer;
        newBooking.lastNameCustomer = this.bookingForm.value.lastNameCustomer;
        newBooking.mailCustomer = this.bookingForm.value.mailCustomer;
        newBooking.phoneCustomer = this.bookingForm.value.phoneCustomer;
        newBooking.dateOfBirthdayCustomer = this.bookingForm.value.dateOfBirthdayCustomer;
        newBooking.priceBooking = this.tarif;
        newBooking.licensePlateCar = this.bookingForm.value.licensePlateCar;
        newBooking.modelCar = this.modelCar;
        newBooking.brandCar = this.brandCar;
        newBooking.dateOfCirculationCar = this.dateOfCirculationCar;
        newBooking.colorCar = this.colorCar;
        newBooking.versionCar = this.versionCar;
        newBooking.motorizationCar = this.motorizationCar;
        console.log('hoursforth',this.bookingForm.value.hoursForth);
        console.log('hoursback',this.bookingForm.value.hoursBack);
        if (this.bookingForm.value.hoursForth != null && this.bookingForm.value.hoursBack === null) {
          this.dateForth = this.bookingForm.get('hoursForth').value.substr(6, 16);
          this.hoursForth = this.bookingForm.get('hoursForth').value.substr(0,5);
        } else if(this.bookingForm.value.hoursForth === null && this.bookingForm.value.hoursBack != null) {
          this.dateBack = this.bookingForm.get('hoursBack').value.substr(6, 16);
          this.hoursBack = this.bookingForm.get('hoursBack').value.substr(0,5);
        } else if (this.bookingForm.value.hoursForth != null && this.bookingForm.value.hoursBack != null) {
          this.dateForth = this.bookingForm.get('hoursForth').value.substr(6, 16);
          this.hoursForth = this.bookingForm.get('hoursForth').value.substr(0,5);
          this.dateBack = this.bookingForm.get('hoursBack').value.substr(6, 16);
          this.hoursBack = this.bookingForm.get('hoursBack').value.substr(0,5);
        }
        newBooking.dateForth = this.dateForth;
        newBooking.hoursForth = this.hoursForth;
        newBooking.dateBack = this.dateBack
        newBooking.hoursBack = this.hoursBack;
      }
     
      rebuilderForm(){
        this.bookingForm.reset(
          {
            address: '',
            addressForth: '',
            addressBack: '',
            addressBilling: ''
          }
        );
      }
     
    }

    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    <div class="row mt-5 mb-5">
      <div class="col-12 text-center">
          <h2>Prendre un rendez-vous</h2>
      </div>
    </div>
     
    <div class="row">
      <form class="col-10 offset-1" [formGroup]="bookingForm" (ngSubmit)="onSubmitFormBooking()">
        <div class="row">
          <div class="col-6">
            <h3 class="text-center mb-4">Choix de la formule</h3>
          </div>
        </div>
        <div class="row d-flex">
          <div class="mb-3 col-6">
            <div class="row input-field d-flex flex-row mb-2">
              <div class="input-field d-flex mt-radio flex-colunm col-7">
                      <p class="d-flex flex-row">
                        <input name="formulaBooking" type="radio" value="simple" class="validate m-auto" id="simple" formControlName="formulaBooking" (change)="changeFormulaBooking($event)">
                        <label for="formulaBooking">Trajet simple</label>
                      </p>
              </div>
              <div class="input-field d-flex mt-radio flex-colunm col-5">
                      <p class="d-flex flex-row">
                        <input name="formulaBooking" type="radio" value="round" class="validate m-auto" id="round" formControlName="formulaBooking" (change)="changeFormulaBooking($event)">
                        <label for="formulaBooking">Aller/Retour</label>
                      </p>
              </div>
            </div>
            <div class="row input-field d-flex flex-row mb-2" *ngIf="this.bookingForm.value.formulaBooking === 'simple' || this.bookingForm.value.formulaBooking === 'forth' || this.bookingForm.value.formulaBooking === 'back' ">
              <div class="input-field d-flex mt-radio flex-colunm">
                <label class="col-4 mr-0" for="formulaBooking">Type de trajet</label>
                <select class="validate col-8" id="formulaBooking" formControlName="formulaBooking" required>
                  <option value="Selectionnez un type de trajet" disabled selected>Sélectionnez un type de trajet</option>
                  <option value="forth" (change)="changeFormulaBooking($event)">Prise en charge</option>
                  <option value="back" (change)="changeFormulaBooking($event)">Restitution</option>
                </select>
              </div>
            </div>
          </div>
          <div class="mb-3 col-6" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'forth' && this.bookingForm.value.formulaBooking != 'back'}">
            <div class="input-field d-flex flex-row mb-70">
              <div class="input-field col-12">
                <div class="label" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'forth'}">
                  <label for="address" >Adresse de prise en charge</label>
                </div>
                <div class="label" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'back'}">
                  <label for="address" >Adresse de restitution</label>
                </div>
                <input type="text" class="validate" id="address" formControlName="address">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
          </div>
          <div class="mb-3 col-6" [ngClass]="{'d-none': this.bookingForm.value.formulaBooking != 'round'}">
            <div class="input-field d-flex flex-row mb-70">
              <div class="input-field col-12">
                <label for="addressForth">Adresse de prise en charge</label>
                <input type="text" class="validate" id="addressForth1" formControlName="addressForth">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="addressBack">Adresse de restitution</label>
                <input type="text" class="validate" id="addressBack1" formControlName="addressBack">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
          </div>
        </div>
        <div class="row d-flex mb-5">
          <div class="input-field text-center m-auto">
            <a class="m-auto size" id="btn" (click)="getDist()">Tarif</a>
          </div>
          <div class="input-field text-center" *ngIf="this.tarif != undefined && this.tarif != 'nous contacter'">
            <h3>Le tarif de la prestation est de {{ tarif }}</h3>
          </div>
          <div class="input-field text-center" *ngIf="this.tarif === 'nous contacter'">
            <h3><strong>Distance trop importante trajet indisponible</strong></h3>
          </div>
        </div>
     
        <div class="row d-flex">
          <div class="col-6 colInfoLeft" *ngIf="this.tarif != undefined && this.tarif != 'nous contacter' ">
            <h3 class="text-center mb-4">Information client</h3>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6">
                <label for="firstNameCustomer">Nom du client</label>
                <input required type="text" class="validate" id="firstNameCustomer" formControlName="firstNameCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
              <div class="input-field col-6">
                <label for="lastNameCustomer">Prénom du client</label>
                <input required type="text" class="validate" id="lastNameCustomer" formControlName="lastNameCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6">
                <label for="phoneCustomer">Téléphone du client</label>
                <input required type="text" class="validate" id="phoneCustomer" formControlName="phoneCustomer">
                <!-- <div class="messageError">
                  <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
              <div class="input-field col-6">
                <label for="mailCustomer">E-mail</label>
                <input type="text" class="validate" id="mailCustomer" formControlName="mailCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="dateOfBirthdayCustomer">Date de naissance du client</label>
                <input type="date" class="validate" id="dateOfBirthdayCustomer" formControlName="dateOfBirthdayCustomer">
                <!-- <div class="messageError">
                    <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <h3 class="text-center mb-4 mt-4">Information véhicule</h3>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-12">
                <label for="licensePlateCar">Plaque d'immatriculation</label>
                <input required type="text" class="validate" id="licensePlateCar" formControlName="licensePlateCar">
                <!-- <div class="messageError">
                  <sup>*</sup>Champ obligatoire
                </div> -->
              </div>
            </div>
            <div class="mt-5 mb-5 text-center">
              <a class="m-auto size" id="btn" (click)="getCar()">Valider la plaque</a>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6"*ngIf="this.brandCar != null" >
                <label for="brandCar">Marque</label>
                <input required type="text" class="validate" id="brandCar" formControlName="brandCar">
              </div>
              <div class="input-field col-6" *ngIf="this.modelCar != null">
                <label for="modelCar">Modèle</label>
                <input required type="text" class="validate" id="modelCar" formControlName="modelCar">
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6" *ngIf="this.dateOfCirculationCar != null">
                <label for="dateOfCirculationCar">Date de mise en circulation</label>
                <input required type="text" class="validate" id="dateOfCirculationCar" formControlName="dateOfCirculationCar">
              </div>
              <div class="input-field col-6" *ngIf="this.motorizationCar != null">
                <label for="motorizationCar">Motorisation</label>
                <input required type="text" class="validate" id="motorizationCar" formControlName="motorizationCar">
              </div>
            </div>
            <div class="input-field d-flex flex-row mb">
              <div class="input-field col-6" *ngIf="this.colorCar != null">
                <label for="colorCar">Couleur</label>
                <input required type="text" class="validate" id="colorCar" formControlName="colorCar">
              </div>
              <div class="input-field col-6" *ngIf="this.versionCar != null">
                <label for="versionCar">Version</label>
                <input required type="text" class="validate" id="versionCar" formControlName="versionCar">
              </div>
            </div>
          </div>
          <div class="col-6 text-center" >
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <h3 class="text-center m-auto mb-4">Créneau de prise en charge</h3>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <pagination-controls id='pagination1' class="hide-page-numbers m-auto" (pageChange)="p = $event" previousLabel="prec" nextLabel="suiv"></pagination-controls>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center"*ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination1', itemsPerPage: 3, currentPage: p }">
                <p class="hoursBooking">{{ hoursBooking.datebookingCalendar }}</p>
              </div>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'forth' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center" *ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination1', itemsPerPage: 3, currentPage: p }">
                <div class="radio-group">
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h1bookingCalendar" id="h1Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h1Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">07:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h2bookingCalendar" id="h2Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h2Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">08:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h3bookingCalendar" id="h3Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h3Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">09:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h4bookingCalendar" id="h4Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h4Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">10:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h5bookingCalendar" id="h5Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h5Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">11:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h6bookingCalendar" id="h6Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h6Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">13:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h7bookingCalendar" id="h7Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h7Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">14:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h8bookingCalendar" id="h8Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h8Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">15:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h9bookingCalendar" id="h9Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h9Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">16:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h10bookingCalendar" id="h10Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h10Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">17:30</label>
                  <input name="hoursForth" type="radio" [value]="hoursBooking.h11bookingCalendar" id="h11Forth-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursForth" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h11Forth-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">18:30</label>
                </div>
              </div>
            </div>
     
            <div class="row sepHoursBooking" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <h3 class="text-center m-auto title">Créneau de restitution</h3>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <pagination-controls id='pagination2' class="hide-page-numbers m-auto" (pageChange)="p2 = $event" previousLabel="prec" nextLabel="suiv"></pagination-controls>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center"*ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination2', itemsPerPage: 3, currentPage: p2 }">
                <p class="hoursBooking">{{ hoursBooking.datebookingCalendar }}</p>
              </div>
            </div>
            <div class="row" *ngIf="this.formulaBooking === 'back' ||  this.formulaBooking === 'round' ">
              <div class="col-4 m-auto text-center" *ngFor="let hoursBooking of hoursBookings | paginate: { id: 'pagination2', itemsPerPage: 3, currentPage: p2 }">
                <div class="radio-group">
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h1bookingCalendar" id="h1Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h1Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h1bookingCalendar === 'pris'}">07:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h2bookingCalendar" id="h2Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h2Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h2bookingCalendar === 'pris'}">08:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h3bookingCalendar" id="h3Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h3Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h3bookingCalendar === 'pris'}">09:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h4bookingCalendar" id="h4Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h4Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h4bookingCalendar === 'pris'}">10:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h5bookingCalendar" id="h5Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h5Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h5bookingCalendar === 'pris'}">11:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h6bookingCalendar" id="h6Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h6Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h6bookingCalendar === 'pris'}">13:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h7bookingCalendar" id="h7Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h7Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h7bookingCalendar === 'pris'}">14:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h8bookingCalendar" id="h8Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h8Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h8bookingCalendar === 'pris'}">15:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h9bookingCalendar" id="h9Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h9Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h9bookingCalendar === 'pris'}">16:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h10bookingCalendar" id="h10Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h10Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h10bookingCalendar === 'pris'}">17:30</label>
                  <input name="hoursBack" type="radio" [value]="hoursBooking.h11bookingCalendar" id="h11Back-{{hoursBooking.idBookingCalendar}}" class="validate m-auto hoursBookingRadio" formControlName="hoursBack" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">
                  <label class="hoursBookingLabel" for="h11Back-{{hoursBooking.idBookingCalendar}}" [ngClass]="{'d-none': hoursBooking.h11bookingCalendar === 'pris'}">18:30</label>
                </div>
              </div>
            </div>
     
          </div>
          <div class="col-12 mt-5 mb-5 text-center">
            <button class="m-auto" id="btn" type="submit">Ajouter un rendez-vous</button>
          </div>
        </div>
      </form>
    </div>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Flex3] Envois de données par formulaire
    Par DBA_OCP dans le forum Flex
    Réponses: 8
    Dernier message: 24/12/2010, 12h59
  2. Envoi de données de formulaire
    Par klmload dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 15/12/2009, 11h16
  3. [MySQL] Envoi de données dans formulaire d'édition
    Par knebhi dans le forum PHP & Base de données
    Réponses: 17
    Dernier message: 03/08/2009, 17h24
  4. [MySQL] message d'erreur lors de l'envois des données du formulaires
    Par paolo129 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 16/12/2008, 18h14
  5. [AJAX] envoie de données à un formulaire de manière asynchrone
    Par comcom94 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 24/10/2008, 19h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo