Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.9 kB
3
Indexable
Never
function AddNextDay(indexOfElement){
  let html=`<div class="col-3">
            <span>Dzień ${elementIndex + 1}</span>
          </div>
          <div class="col-3">
            <label for="elements_${indexOfElement}_days_${elementIndex}_date" class="form-label fw-bold">Data*:</label>
            <input
              type="date"
              class="form-control"
              id="elements_${indexOfElement}_days_${elementIndex}_date"
              name="elements[${indexOfElement}][days][${elementIndex}][date]"
              required
            />
            <div class="invalid-feedback">Data jest wymagana!</div>
          </div>
          <div class="col-3">
            <label for="elements_${indexOfElement}_days_${elementIndex}_start" class="form-label fw-bold">
              Godzina startu*:
            </label>
            <input
              type="time"
              class="form-control"
              id="elements_${indexOfElement}_days_${elementIndex}_start"
              name="elements[${indexOfElement}][days][${elementIndex}][start]"
              required
            />
            <div class="invalid-feedback">Godzina startu jest wymagana!</div>
          </div>
          <div class="col-3">
            <label for="elements_${indexOfElement}_days_${elementIndex}_stop" class="form-label fw-bold">
              Godzina zakończenia*:
            </label>
            <input
              type="time"
              class="form-control"
              id="elements_${indexOfElement}_days_${elementIndex}_stop"
              name="elements[${indexOfElement}][days][${elementIndex}][stop]"
              required
            />
            <div class="invalid-feedback">Godzina zakończenia jest wymagana!</div>
          </div>`;
          elementIndex++;
          $("#daysContainer_" + indexOfElement).append(html);
};