Skip to content

Commit

Permalink
new event fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ssftvyn committed May 22, 2024
1 parent fa55939 commit 0cd9ed2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/view/edit-point-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const editingPointView = (point, destinations, offersIds, isNewPoint) =>
${type}
</label>
<input class="event__input event__input--destination" id="event-destination-${destination}"
type="text" name="event-destination" value="${he.encode(destinationData.name)}"
type="text" name="event-destination" value="${destinationData ? he.encode(destinationData.name) : ''}"
list="destination-list-1" ${isDisabled ? 'disabled' : ''}>
<datalist id="destination-list-1" ${isDisabled ? 'disabled' : ''}>
${generateDestinations(destinations, isDisabled)}
Expand Down Expand Up @@ -138,15 +138,15 @@ export const editingPointView = (point, destinations, offersIds, isNewPoint) =>
</div>
</section>
<section class="event__section event__section--destination">
${destinationData ? `<section class="event__section event__section--destination">
<h3 class="event__section-title event__section-title--destination">Destination</h3>
<p class="event__destination-description">${destinationData.description}</p>
<div class="event__photos-container">
<div class="event__photos-tape">
${createPhotosTemplates(destinationData.pictures)}
</div>
</div>
</section>
</section>` : ''}
</section>
</form>
</li>`
Expand Down
6 changes: 3 additions & 3 deletions src/view/point-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const createOffersTemplates = (allOffers, checkedOffers) => {

export const pointView = (point, destinations, offersIds) => {
const {type, destination, startDate, endDate, price, isFavorite, offers} = point;
const dateFrom = startDate !== null ? humanizePointDate(startDate, 'DD/MM/YY HH:mm') : '';
const dateTo = endDate !== null ? humanizePointDate(endDate, 'DD/MM/YY HH:mm') : '';
const date = startDate !== null ? humanizePointDate(startDate, 'D MMMM') : '';
const dateFrom = startDate !== null ? humanizePointDate(startDate, 'HH:mm') : '';
const dateTo = endDate !== null ? humanizePointDate(endDate, 'HH:mm') : '';
const date = startDate !== null ? humanizePointDate(startDate, 'MMM D') : '';
const allTypeOffers = offersIds.find((offer) => offer.type === type);
const favoriteClass = isFavorite ? 'event__favorite-btn--active' : '';
const destinationData = destinations.find((dest) => dest.id === destination);
Expand Down

0 comments on commit 0cd9ed2

Please sign in to comment.