\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
{t('VIDEO_STORE')}
\n
\n
\n
\n setPartnerFilter(e.target.value)} onKeyPress={event => {if (event.key === 'Enter') {event.preventDefault();}}}/>\n \n \n {renderEmptyPageString()}\n
\n
\n
\n
\n
\n
\n {partners.map(p =>\n (\n p.videoStore && (partnerFilter === \"\" || p.name.toLowerCase().indexOf(partnerFilter.toLowerCase()) > -1)?\n
\n : null\n )\n )}\n
\n
\n
\n
\n \n \n
\n \n );\n};\n\nPlayerVideoStore.propTypes = {\n token: PropTypes.string,\n partners: PropTypes.array,\n profile: PropTypes.object.isRequired,\n goto: PropTypes.func.isRequired,\n showVideoStorePartner: PropTypes.func.isRequired,\n showPlayerHowPurchaseModal: PropTypes.func.isRequired,\n subscriptions: PropTypes.object\n};\n\nPlayerVideoStore.defaultProps = {\n token: null,\n partners: [],\n subscriptions: []\n};\n\nconst mapStateToProps = ({login: {token, profile}, player: {partners, subscriptions}}) => ({\n token,\n profile,\n partners,\n subscriptions\n});\n\nconst mapDispatchToProps = dispatch => ({\n showVideoStorePartner: (partner, subscriptions) => () => {\n dispatch(partnerSelected(partner));\n dispatch(getPartnerFields(partner.uid));\n dispatch(getPartnerServices(partner.uid));\n dispatch(getVideosStore(partner.uid));\n dispatch(getVideosStorePartnerVideo(partner.uid));\n dispatch(setPlayerVideoStoreActiveTab('watch_now'));\n const subscriptionStatus = getSubscriptionStatus(partner, subscriptions);\n if (subscriptionStatus.status === subscriptionStatuses.valid || subscriptionStatus.status === subscriptionStatuses.unlimited) {\n dispatch(getRtvVideos(partner.uid));\n if (partner.rtvChannels.filter(c => c.type === 1).length){\n dispatch(getRtvPartnerVideos(partner.uid, partner.rtvChannels.filter(c => c.type === 1)[0].id));\n }\n }\n dispatch(push('/player-video-store-partner'));\n },\n showPlayerHowPurchaseModal: () => {\n dispatch(showPlayerHowPurchaseModal());\n },\n goto: (path, action = null) => e => {\n e.preventDefault();\n if (action) {\n dispatch(action());\n }\n\n dispatch(push(path));\n }\n});\n\nexport default withRouter(connect(\n mapStateToProps,\n mapDispatchToProps\n)(PlayerVideoStore));\n","/* eslint complexity: [\"error\", 40] */\n\nimport React, {Fragment} from 'react';\nimport PropTypes from 'prop-types';\nimport {connect} from 'react-redux';\nimport {withRouter, Redirect} from 'react-router-dom';\nimport {Button, Container, Dropdown, DropdownButton, Fade, Form, Tabs, Tab} from 'react-bootstrap';\nimport {push} from 'connected-react-router';\nimport {Formik} from 'formik';\nimport DatePicker, {registerLocale} from 'react-datepicker';\nimport Dialog from 'react-bootstrap-dialog';\nimport queryString from 'query-string';\nimport CommonMetaTag from './common-meta-tag';\nimport {addVideoToPlayerArea, addPartnerVideoToPlayerArea, getVideosStore, purchaseVideo, showPlayerHowPurchaseModal, purchasePartnerVideo, myVideoActiveTab, setPlayerVideoStoreActiveTab} from '../actions/player';\nimport PlayerHowPurchase from './player-how-purchase';\nimport coming_soon from '../images/video_store_coming_soon.png';\nimport defaultFieldImage from '../images/default_field_image.png'\nimport {useTranslation} from 'react-i18next';\nimport Configuration from '../config';\n\nconst PlayerVideoStorePartner = ({\n token,\n selectedPartner,\n profile,\n goto,\n videosStore,\n videosStoreSoon,\n videosStorePartnerVideo,\n addVideoToPlayerArea,\n addPartnerVideoToPlayerArea,\n selectedPartnerFields,\n selectedPartnerServices,\n searchVideos,\n purchaseVideo,\n purchasePartnerVideo,\n rtvVideos,\n rtvPartnerVideos,\n showPlayerHowPurchaseModal,\n video,\n permanentVideos,\n permanentPartnerVideos,\n playerVideoStoreActiveTab,\n setActiveTab,\n location: {search}\n}) => {\n const {t, i18n} = useTranslation();\n if (token === null) {\n return (\n
\n );\n }\n\n const params = queryString.parse(search);\n const confirmMessage = price => (\n \n );\n\n let dialog = null;\n const confirmPurchase = (slots, price) => () => {\n dialog.show({\n title: t('CONFIRM_PURCHASE_TITLE'),\n body: confirmMessage(price),\n actions: [\n Dialog.Action(\n t('YES'),\n () => purchaseVideo(slots),\n 'btn btn-secondary'\n ),\n Dialog.Action(\n t('NO'),\n null,\n 'btn btn_red_outline_rp'\n )\n ],\n bsSize: 'small',\n onHide: dialog => {\n dialog.hide();\n }\n });\n };\n\n const confirmPurchasePartnerVideo = (videoId, price) => () => {\n dialog.show({\n title: t('CONFIRM_PURCHASE_TITLE'),\n body: confirmMessage(price),\n actions: [\n Dialog.Action(\n t('YES'),\n () => purchasePartnerVideo(videoId),\n 'btn btn-secondary'\n ),\n Dialog.Action(\n t('NO'),\n null,\n 'btn btn_red_outline_rp'\n )\n ],\n bsSize: 'small',\n onHide: dialog => {\n dialog.hide();\n }\n });\n };\n\n const videoAlreadyPurchased = () => {\n dialog.show({\n title: t('MY_VIDEO'),\n body: t('VIDEO_ALREADY_COPIED'),\n actions: [\n Dialog.Action(\n t('CLOSE_BUTTON'),\n null,\n 'btn btn_red_outline_rp'\n )\n ],\n bsSize: 'small',\n onHide: dialog => {\n dialog.hide();\n }\n });\n };\n\n const isPurchased = slotId => {\n if (video.find(v => v.slotId === slotId)) {\n return true;\n }\n\n if (permanentVideos.find(v => v.slotId === slotId)) {\n return true;\n }\n\n if (rtvVideos && rtvVideos.find(v => v.id === slotId)) {\n return true;\n }\n \n return false;\n };\n\n const isPartnerVideoPurchased = videoName => {\n if (permanentPartnerVideos.find(v => v.videoName === videoName)) {\n return true;\n }\n\n if (rtvPartnerVideos && rtvPartnerVideos.find(v => v.videoName === videoName)) {\n return true;\n }\n\n return false;\n };\n\n const setValueForField = (f, id) => {\n f('fieldId', id);\n f('serviceId', null);\n };\n\n const setValueForService = (f, id) => {\n f('fieldId', null);\n f('serviceId', id);\n };\n\n const getFieldImage = (partnerId, fieldId, fieldImage) => {\n return `${Configuration.apiEndPoint}/partners/fields/${fieldId}/images?load=${fieldImage}`\n }\n\n const getCoverImage = (partnerId, coverImage, defaultImage, videoId) => {\n if (coverImage && coverImage[0]) {\n return {backgroundImage: `url(${Configuration.apiEndPoint}/video_partners/${videoId}/images?load=${coverImage[0]}`, backgroundSize: 'cover'};\n }\n if (defaultImage && defaultImage[0]) {\n return {backgroundImage: `url(${Configuration.apiEndPoint}/images/${partnerId}?load=${defaultImage[0]}`, backgroundSize: 'cover'};\n }\n\n return {backgroundImage: defaultFieldImage, backgroundSize: 'cover'};;\n };\n\n return (\n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
{t('VIDEO_STORE_PARTNER', {partner: selectedPartner.name})}
\n
\n \n \n {selectedPartnerFields.filter(f => f.recording).length ?\n
\n
\n
\n
\n {({\n handleSubmit,\n handleChange,\n setFieldValue,\n values\n }) => {\n return (\n \n setFieldValue('fromDatetime', val ? val.toISOString() : val)}/>\n \n \n setFieldValue('toDatetime', val ? val.getHours() === 0 && val.getMinutes() === 0 ? new Date(val.setHours(23,59)).toISOString() : val.toISOString() : val)}/>\n \n \n \n
\n \n \n
\n \n );\n }}\n \n
\n
\n
\n
\n
\n :\n selectedPartnerFields.filter(f => f.recording).length ?\n
\n : null}\n
\n setActiveTab(t)}>\n \n \n {\n videosStore && videosStore.length > 0 ?\n videosStore.map(v => (\n
\n
\n
\n

new Date() ? coming_soon: v.fieldId && v.fieldImage && v.partnerId ? getFieldImage(v.partnerId, v.fieldId, v.fieldImage) : defaultFieldImage} alt={t('VIDEO_STORE')} style={{width: '100%', height: '100%'}}/>\n
\n
\n
\n {v.description}\n
\n
{new Date(v.timestamp).toLocaleDateString()} {new Date(v.timestamp).toTimeString().slice(0, 5)}
\n
{v.fieldName}
\n {\n v.event ?\n
:\n v.reserved ?\n
:\n
\n }\n
\n {t('DURATION')}{new Date(v.duration * 1000).toISOString().slice(11, 19)}\n
\n {v.filesize ?\n
\n {t('FILE_SIZE')}{(Math.floor(v.filesize)/(1000000000)).toFixed(2)}GB\n
\n : null }\n
\n
\n {\n !isPurchased(v.id) ?\n
\n {t('PRICE')}:{v.price} €\n
\n : null\n }\n
\n
\n
\n
\n ))\n :
\n \n \n }\n
\n \n
\n \n {\n videosStoreSoon && videosStoreSoon.length > 0 ?\n videosStoreSoon.map(v => (\n
\n
\n
\n

new Date() ? coming_soon: v.fieldId && v.fieldImage && v.partnerId ? getFieldImage(v.partnerId, v.fieldId, v.fieldImage) : defaultFieldImage} alt={t('VIDEO_STORE')} style={{width: '100%', height: '100%'}}/>\n
\n
\n
\n {v.description}\n
\n
{new Date(v.timestamp).toLocaleDateString()} {new Date(v.timestamp).toTimeString().slice(0, 5)}
\n
{v.fieldName}
\n {\n v.event ?\n
:\n v.reserved ?\n
:\n
\n }\n
\n {t('DURATION')}{new Date(v.duration * 1000).toISOString().slice(11, 19)}\n
\n
\n
\n {\n !isPurchased(v.id) ?\n
\n {t('PRICE')}:{v.price} €\n
\n : null\n }\n
\n
\n
\n
\n ))\n :
\n \n \n }\n
\n \n \n \n
\n \n \n {\n videosStorePartnerVideo && videosStorePartnerVideo.length > 0 ?\n videosStorePartnerVideo.map(v => (\n
\n
\n
\n
\n
\n
\n
{v.title}
\n
\n {selectedPartner.name}\n
\n
\n {v.description}\n
\n
\n {t('FILE_SIZE')}: {(Math.floor(v.filesize)/(1000000000)).toFixed(2)}GB\n
\n
\n
\n {\n !isPartnerVideoPurchased(v.videoName) ?\n
\n {t('PRICE')}:{v.videoPrice} €\n
\n : null\n }\n
\n
\n
\n
\n ))\n :
\n \n \n }\n
\n \n \n
\n \n
\n
\n \n \n \n
\n