|
238 | 238 | const addModalBodyForm = document.createElement('form'); |
239 | 239 | const addModalBodySurnameInputWrap = document.createElement('div'); |
240 | 240 | const addModalBodySurnameInput = document.createElement('input'); |
241 | | - const addModalBodySurnameSpan = document.createElement('span'); |
| 241 | + const addModalBodySurnameInputLabel = document.createElement('label'); |
| 242 | + const addModalBodySurnameLabelSpan = document.createElement('span'); |
242 | 243 | const addModalBodySurnameFeedback = document.createElement('div'); |
243 | 244 | const addModalBodyNameInputWrap = document.createElement('div'); |
244 | 245 | const addModalBodyNameInput = document.createElement('input'); |
245 | | - const addModalBodyNameSpan = document.createElement('span'); |
| 246 | + const addModalBodyNameInputLabel = document.createElement('label'); |
| 247 | + const addModalBodyNameInputLabelSpan = document.createElement('span'); |
246 | 248 | const addModalBodyNameFeedback = document.createElement('div'); |
247 | 249 | const addModalBodyPatronymicInputWrap = document.createElement('div'); |
248 | 250 | const addModalBodyPatronymicInput = document.createElement('input'); |
| 251 | + const addModalBodyPatronymicInputLabel = document.createElement('label'); |
249 | 252 | const addModalBodyPatronymicFeedback = document.createElement('div'); |
250 | 253 | const addModalFooter = document.createElement('div'); |
251 | 254 | const addModalFooterAddBtnWrap = document.createElement('div'); |
|
272 | 275 | addModalBodyForm.classList.add('modal__add-body-form', 'needs-validation'); |
273 | 276 | addModalBodySurnameInputWrap.classList.add( |
274 | 277 | 'modal__add-body-input-wrap', |
275 | | - 'add-surname-input-wrap' |
| 278 | + 'add-surname-input-wrap', |
| 279 | + 'form-floating' |
276 | 280 | ); |
277 | 281 | addModalBodySurnameInput.classList.add( |
278 | 282 | 'modal__add-body-input', |
279 | 283 | 'add-surname-input', |
280 | 284 | 'form-control' |
281 | 285 | ); |
282 | | - addModalBodySurnameSpan.classList.add( |
283 | | - 'modal__add-body-span', |
284 | | - 'add-surname-input-span' |
| 286 | + addModalBodySurnameInputLabel.classList.add( |
| 287 | + 'modal__add-body-input-label', |
| 288 | + 'add-surname-input-labe' |
| 289 | + ); |
| 290 | + addModalBodySurnameLabelSpan.classList.add( |
| 291 | + 'modal__add-body-label-span', |
| 292 | + 'add-surname-input-label-span' |
285 | 293 | ); |
286 | 294 | addModalBodySurnameFeedback.classList.add( |
287 | 295 | 'modal__add-body-input-feedback', |
|
290 | 298 | ); |
291 | 299 | addModalBodyNameInputWrap.classList.add( |
292 | 300 | 'modal__add-body-input-wrap', |
293 | | - 'add-name-input-wrap' |
| 301 | + 'add-name-input-wrap', |
| 302 | + 'form-floating' |
294 | 303 | ); |
295 | 304 | addModalBodyNameInput.classList.add( |
296 | 305 | 'modal__add-body-input', |
297 | 306 | 'add-name-input', |
298 | 307 | 'form-control' |
299 | 308 | ); |
300 | | - addModalBodyNameSpan.classList.add( |
301 | | - 'modal__add-body-span', |
302 | | - 'add-name-input-span' |
| 309 | + addModalBodyNameInputLabel.classList.add( |
| 310 | + 'modal__add-body-input-label', |
| 311 | + 'add-name-input-labe' |
| 312 | + ); |
| 313 | + addModalBodyNameInputLabelSpan.classList.add( |
| 314 | + 'modal__add-body-label-span', |
| 315 | + 'add-name-input-label-span' |
303 | 316 | ); |
304 | 317 | addModalBodyNameFeedback.classList.add( |
305 | 318 | 'modal__add-body-input-feedback', |
|
308 | 321 | ); |
309 | 322 | addModalBodyPatronymicInputWrap.classList.add( |
310 | 323 | 'modal__add-body-input-wrap', |
311 | | - 'add-patronymic-input-wrap' |
| 324 | + 'add-patronymic-input-wrap', |
| 325 | + 'form-floating' |
312 | 326 | ); |
313 | 327 | addModalBodyPatronymicInput.classList.add( |
314 | 328 | 'modal__add-body-input', |
315 | 329 | 'add-patronymic-input', |
316 | 330 | 'form-control' |
317 | 331 | ); |
| 332 | + addModalBodyPatronymicInputLabel.classList.add( |
| 333 | + 'modal__add-body-input-label', |
| 334 | + 'add-patronymic-input-labe' |
| 335 | + ); |
318 | 336 | addModalBodyPatronymicFeedback.classList.add( |
319 | 337 | 'modal__add-body-input-feedback', |
320 | 338 | 'patronymic-input-feedback', |
|
357 | 375 | addModalBodyForm.setAttribute('id', 'add-modal-form'); |
358 | 376 | addModalBodyForm.setAttribute('action', '#'); |
359 | 377 | addModalBodyForm.setAttribute('novalidate', ''); |
360 | | - addModalBodySurnameInput.setAttribute('id', 'add-surname-input'); |
| 378 | + addModalBodySurnameInput.setAttribute('id', 'add-surname-floating-input'); |
361 | 379 | addModalBodySurnameInput.setAttribute('type', 'text'); |
362 | 380 | addModalBodySurnameInput.setAttribute('pattern', '[А-Яа-яЁё\\-]+'); |
363 | 381 | addModalBodySurnameInput.setAttribute('placeholder', 'Фамилия'); |
364 | 382 | addModalBodySurnameInput.setAttribute('required', ''); |
365 | | - addModalBodyNameInput.setAttribute('id', 'add-name-input'); |
| 383 | + addModalBodySurnameInputLabel.setAttribute( |
| 384 | + 'for', |
| 385 | + 'add-surname-floating-input' |
| 386 | + ); |
| 387 | + addModalBodyNameInput.setAttribute('id', 'add-name-floating-input'); |
366 | 388 | addModalBodyNameInput.setAttribute('type', 'text'); |
367 | 389 | addModalBodyNameInput.setAttribute('pattern', '[А-Яа-яЁё\\-]+'); |
368 | 390 | addModalBodyNameInput.setAttribute('placeholder', 'Имя'); |
369 | 391 | addModalBodyNameInput.setAttribute('required', ''); |
370 | | - addModalBodyPatronymicInput.setAttribute('id', 'add-patronymic-input'); |
| 392 | + addModalBodyNameInputLabel.setAttribute('for', 'add-name-floating-input'); |
| 393 | + addModalBodyPatronymicInput.setAttribute( |
| 394 | + 'id', |
| 395 | + 'add-patronymic-floating-input' |
| 396 | + ); |
371 | 397 | addModalBodyPatronymicInput.setAttribute('type', 'text'); |
372 | 398 | addModalBodyPatronymicInput.setAttribute('pattern', '[А-Яа-яЁё\\-]+'); |
373 | 399 | addModalBodyPatronymicInput.setAttribute('placeholder', 'Отчество'); |
374 | 400 | addModalBodyPatronymicInput.setAttribute('required', ''); |
| 401 | + addModalBodyPatronymicInputLabel.setAttribute( |
| 402 | + 'for', |
| 403 | + 'add-patronymic-floating-input' |
| 404 | + ); |
375 | 405 | addModalFooterAddBtn.setAttribute('id', 'add-modal-footer-add-btn'); |
376 | 406 | addModalFooterAddBtn.setAttribute('type', 'button'); |
377 | 407 | addModalFooterSaveBtn.setAttribute('id', 'add-modal-footer-save-btn'); |
|
382 | 412 |
|
383 | 413 | addBtnText.textContent = 'Добавить клиента'; |
384 | 414 | addModalHeaderTitle.textContent = 'Новый клиент'; |
| 415 | + addModalBodySurnameInputLabel.textContent = 'Фамилия'; |
| 416 | + addModalBodySurnameLabelSpan.textContent = '*'; |
385 | 417 | addModalBodySurnameFeedback.textContent = |
386 | 418 | 'Введены не корректные данные.. исключите: английские буквы, цифры!'; |
| 419 | + addModalBodyNameInputLabel.textContent = 'Имя'; |
| 420 | + addModalBodyNameInputLabelSpan.textContent = '*'; |
387 | 421 | addModalBodyNameFeedback.textContent = |
388 | 422 | 'Введены не корректные данные.. исключите: английские буквы, цифры!'; |
| 423 | + addModalBodyPatronymicInputLabel.textContent = 'Отчество'; |
389 | 424 | addModalBodyPatronymicFeedback.textContent = |
390 | 425 | 'Введены не корректные данные.. исключите: английские буквы, цифры!'; |
391 | | - addModalBodySurnameSpan.textContent = '*'; |
392 | | - addModalBodyNameSpan.textContent = '*'; |
393 | 426 | addModalFooterAddBtnText.textContent = 'Добавить контакт'; |
394 | 427 | addModalFooterSaveBtn.textContent = 'Сохранить'; |
395 | 428 | addModalFooterCancelBtn.textContent = 'Отмена'; |
396 | 429 |
|
397 | 430 | addBtn.append(addBtnDefaultIcon, addBtnWhiteIcon, addBtnGrayIcon, addBtnText); |
398 | 431 | addBtnWrap.append(addBtn); |
399 | 432 | addModalHeader.append(addModalHeaderTitle, addModalHeaderXBtn); |
| 433 | + addModalBodySurnameInputLabel.append(addModalBodySurnameLabelSpan); |
400 | 434 | addModalBodySurnameInputWrap.append( |
401 | 435 | addModalBodySurnameInput, |
402 | | - addModalBodySurnameSpan, |
| 436 | + addModalBodySurnameInputLabel, |
403 | 437 | addModalBodySurnameFeedback |
404 | 438 | ); |
| 439 | + addModalBodyNameInputLabel.append(addModalBodyNameInputLabelSpan); |
405 | 440 | addModalBodyNameInputWrap.append( |
406 | 441 | addModalBodyNameInput, |
407 | | - addModalBodyNameSpan, |
| 442 | + addModalBodyNameInputLabel, |
408 | 443 | addModalBodyNameFeedback |
409 | 444 | ); |
410 | 445 | addModalBodyPatronymicInputWrap.append( |
411 | 446 | addModalBodyPatronymicInput, |
| 447 | + addModalBodyPatronymicInputLabel, |
412 | 448 | addModalBodyPatronymicFeedback |
413 | 449 | ); |
414 | 450 | addModalBodyForm.append( |
|
0 commit comments