diff --git a/package-lock.json b/package-lock.json
index f9d5e77..ff003bc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,8 @@
"name": "big-trip",
"version": "19.0.0",
"dependencies": {
- "dayjs": "1.11.6"
+ "dayjs": "1.11.6",
+ "flatpickr": "4.6.13"
},
"devDependencies": {
"@babel/core": "7.20.5",
@@ -19,7 +20,7 @@
"eslint": "8.28.0",
"eslint-config-htmlacademy": "8.0.0",
"html-webpack-plugin": "5.6.0",
- "style-loader": "^3.3.1",
+ "style-loader": "3.3.1",
"webpack": "5.75.0",
"webpack-cli": "5.0.0",
"webpack-dev-server": "4.11.1"
@@ -4286,6 +4287,11 @@
"node": "^10.12.0 || >=12.0.0"
}
},
+ "node_modules/flatpickr": {
+ "version": "4.6.13",
+ "resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.13.tgz",
+ "integrity": "sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw=="
+ },
"node_modules/flatted": {
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
@@ -11089,6 +11095,11 @@
"rimraf": "^3.0.2"
}
},
+ "flatpickr": {
+ "version": "4.6.13",
+ "resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.13.tgz",
+ "integrity": "sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw=="
+ },
"flatted": {
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
diff --git a/package.json b/package.json
index 2c9d1a4..779fe47 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"eslint": "8.28.0",
"eslint-config-htmlacademy": "8.0.0",
"html-webpack-plugin": "5.6.0",
- "style-loader": "^3.3.1",
+ "style-loader": "3.3.1",
"webpack": "5.75.0",
"webpack-cli": "5.0.0",
"webpack-dev-server": "4.11.1"
@@ -33,6 +33,8 @@
"node": "18"
},
"dependencies": {
- "dayjs": "1.11.6"
+ "dayjs": "1.11.6",
+ "flatpickr": "4.6.13",
+ "he": "1.2.0"
}
}
diff --git a/src/service/mock-service.js b/src/service/mock-service.js
index fbcf25b..8b2d2bf 100644
--- a/src/service/mock-service.js
+++ b/src/service/mock-service.js
@@ -36,19 +36,10 @@ export default class MockService {
}
generateOffers() {
- return TYPES.map((type) => {
- const offers = Array.from({ length: getRandomInteger(0, OFFER_COUNT) }, () => generateOffer(type));
-
- const offersWithRandomSelection = offers.map((offer, index) => ({
- ...offer,
- included: index < getRandomInteger(0, offers.length - 1)
- }));
-
- return {
- type,
- offers: offersWithRandomSelection
- };
- });
+ return TYPES.map((type) => ({
+ type,
+ offers: Array.from({ length: getRandomInteger(0, OFFER_COUNT) }, () => generateOffer(type))
+ }));
}
generatePoints() {
diff --git a/src/view/edit-point-view.js b/src/view/edit-point-view.js
index 63cab6b..5a3911d 100644
--- a/src/view/edit-point-view.js
+++ b/src/view/edit-point-view.js
@@ -1,6 +1,8 @@
import AbstractStatefulView from '../framework/view/abstract-stateful-view.js';
import { POINT_EMPTY, TYPES, CITIES } from "../const.js";
import { formatStringToDateTime } from '../utils.js';
+import 'flatpickr/dist/flatpickr.min.css';
+import flatpickr from 'flatpickr';
const createPointCitiesOptionsTemplate = () => {
return (
@@ -27,12 +29,13 @@ const createPointTypesTemplate = (currentType) => {
`).join('');
}
-const createPointOffersTemplate = ({ currentOffers }) => {
- const offerItems = currentOffers.map(offer => {
- const isChecked = offer.included ? 'checked' : '';
+const createPointOffersTemplate = ({ offersId, currentOffers }) => {
+ console.log(offersId)
+ const offerItems = currentOffers.map((offer) => {
+ const isChecked = offersId.includes(offer.id) ? 'checked' : '';
return (
`
-
+