diff --git a/ecc/blocks/event-format-component/controller.js b/ecc/blocks/event-format-component/controller.js index fd2be8b3..10bb9df5 100644 --- a/ecc/blocks/event-format-component/controller.js +++ b/ecc/blocks/event-format-component/controller.js @@ -76,7 +76,7 @@ async function populateSeriesOptions(props, component) { const seriesSelect = component.querySelector('#series-select-input'); if (!seriesSelect) return; - const series = await getAllSeries(); + const { series } = await getAllSeries(); if (!series) { seriesSelect.pending = false; seriesSelect.disabled = true; diff --git a/ecc/blocks/product-promotion-component/product-promotion-component.css b/ecc/blocks/product-promotion-component/product-promotion-component.css index e69de29b..25fb22f1 100644 --- a/ecc/blocks/product-promotion-component/product-promotion-component.css +++ b/ecc/blocks/product-promotion-component/product-promotion-component.css @@ -0,0 +1 @@ +/* no css for wrapper block */ diff --git a/ecc/blocks/series-creation-form/series-creation-form.js b/ecc/blocks/series-creation-form/series-creation-form.js index cea3ce6d..2ae8b755 100644 --- a/ecc/blocks/series-creation-form/series-creation-form.js +++ b/ecc/blocks/series-creation-form/series-creation-form.js @@ -401,15 +401,11 @@ async function save(props, toPublish = false) { let resp = props.response; - const onSave = async () => { - - }; - if (!resp.seriesId) { resp = await createSeries(quickFilter(props.payload)); props.response = { ...props.response, ...resp }; updateDashboardLink(props); - + if (resp?.seriesId) await handleSeriesUpdate(props); if (!resp.error) { diff --git a/ecc/blocks/series-dashboard/series-dashboard.js b/ecc/blocks/series-dashboard/series-dashboard.js index a3c85cc9..aab088da 100644 --- a/ecc/blocks/series-dashboard/series-dashboard.js +++ b/ecc/blocks/series-dashboard/series-dashboard.js @@ -16,6 +16,7 @@ import { getDevToken, } from '../../scripts/utils.js'; import { initProfileLogicTree } from '../../scripts/event-apis.js'; +import { quickFilter } from '../series-creation-form/data-handler.js'; const { createTag } = await import(`${LIBS}/utils/utils.js`); @@ -173,7 +174,7 @@ function initMoreOptions(props, config, seriesObj, row) { row.classList.add('pending'); const resp = await unpublishSeries(seriesObj.seriesId, seriesObj); updateDashboardData(resp, props); - + sortData(props, config, { resort: true }); showToast(props, buildToastMsgWithEventTitle(seriesObj.title, config['unpublished-msg']), { variant: 'positive' }); }); @@ -186,9 +187,9 @@ function initMoreOptions(props, config, seriesObj, row) { row.classList.add('pending'); const resp = await publishSeries(seriesObj.seriesId, seriesObj); updateDashboardData(resp, props); - + sortData(props, config, { resort: true }); - + showToast(props, buildToastMsgWithEventTitle(seriesObj.title, config['published-msg']), { variant: 'positive' }); }); } @@ -197,7 +198,7 @@ function initMoreOptions(props, config, seriesObj, row) { // const viewTemplate = buildTool(toolBox, 'View Template', 'preview-eye'); const clone = buildTool(toolBox, 'Clone', 'clone'); - + if (seriesStatus && seriesStatus !== 'archived') { const edit = buildTool(toolBox, 'Edit', 'edit-pencil'); @@ -205,15 +206,14 @@ function initMoreOptions(props, config, seriesObj, row) { url.searchParams.set('seriesId', seriesObj.seriesId); edit.href = url.toString(); - const archive = buildTool(toolBox, 'Archive', 'archive'); archive.addEventListener('click', async (e) => { e.preventDefault(); - + const spTheme = props.el.querySelector('sp-theme.toast-area'); if (!spTheme) return; - + const underlay = spTheme.querySelector('sp-underlay'); const dialog = spTheme.querySelector('sp-dialog'); createTag('h1', { slot: 'heading' }, 'You are archiving this series.', { parent: dialog }); @@ -221,31 +221,31 @@ function initMoreOptions(props, config, seriesObj, row) { const buttonContainer = createTag('div', { class: 'button-container' }, '', { parent: dialog }); const dialogArchiveBtn = createTag('sp-button', { variant: 'secondary', slot: 'button' }, 'Yes, I want to archive this series', { parent: buttonContainer }); const dialogCancelBtn = createTag('sp-button', { variant: 'cta', slot: 'button' }, 'Do not archive', { parent: buttonContainer }); - + underlay.open = true; - + dialogArchiveBtn.addEventListener('click', async () => { toolBox.remove(); underlay.open = false; dialog.innerHTML = ''; row.classList.add('pending'); const resp = await archiveSeries(seriesObj.seriesId); - + if (resp.error) { row.classList.remove('pending'); showToast(props, resp.error, { variant: 'negative' }); return; } - + const newJson = await getAllSeries(); props.data = newJson.series; props.filteredData = newJson.series; props.paginatedData = newJson.series; - + sortData(props, config, { resort: true }); showToast(props, config['delete-toast-msg']); }); - + dialogCancelBtn.addEventListener('click', () => { toolBox.remove(); underlay.open = false; @@ -254,7 +254,7 @@ function initMoreOptions(props, config, seriesObj, row) { }); } // const verHistory = buildTool(toolBox, 'Version History', 'version-history'); - + // clone clone.addEventListener('click', async (e) => { e.preventDefault(); diff --git a/ecc/blocks/series-templates-component/series-templates-component.css b/ecc/blocks/series-templates-component/series-templates-component.css index d10addaa..ceae992a 100644 --- a/ecc/blocks/series-templates-component/series-templates-component.css +++ b/ecc/blocks/series-templates-component/series-templates-component.css @@ -78,7 +78,7 @@ left: 0; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, 0.5); + background-color: rgb(0 0 0 / 50%); z-index: 2; } @@ -157,7 +157,7 @@ background: none; border: none; cursor: pointer; - filter: drop-shadow(1px 1px 1px #ffffff); + filter: drop-shadow(1px 1px 1px #fff); } .series-templates-component .picker-preview-actions button:hover { diff --git a/ecc/samples/sample-form/sample-form.js b/ecc/samples/sample-form/sample-form.js index ad680f4e..ba838a0c 100644 --- a/ecc/samples/sample-form/sample-form.js +++ b/ecc/samples/sample-form/sample-form.js @@ -12,7 +12,6 @@ import { createSeries, updateSeries, publishSeries, - getSeries, } from '../../scripts/esp-controller.js'; import getJoinedData, { getFilteredCachedResponse, quickFilter, setPayloadCache, setResponseCache } from './data-handler.js'; import { initProfileLogicTree } from '../../scripts/event-apis.js'; @@ -217,13 +216,14 @@ async function loadData(props) { const id = urlParams.get('id'); if (!id) return; - + // fetch data to prefill the form - // props.el.classList.add('disabled'); + props.el.classList.add('disabled'); // const data = await getSeries(id); - // props.response = { ...props.response, ...data }; - // props.el.classList.remove('disabled'); + const data = {}; + props.response = { ...props.response, ...data }; + props.el.classList.remove('disabled'); } async function initComponents(props) {