<script type="text/template" id="tmpl-cartflows-flows-list">
<# console.log( data.items.length ) #>
<# console.log( data.items ) #>
<# if ( data.items.length ) { #>
<# for ( key in data.items ) { #>
<#
var flow_steps = [];
if( data.items[ key ].flow_steps ) {
flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
return value['id'];
});
}
#>
<div class="inner">
<div class="template">
<span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
<div class="template-screenshot">
<# if( data.items[ key ].featured_image_url ) { #>
<img src="{{ data.items[ key ].featured_image_url }}" />
<# } else { #>
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
<# } #>
</div>
<#
data.items[ key ].flow_type === 'pro';
if( 'pro' === data.items[ key ].flow_type ) { #>
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
<# } #>
<# if( data.items[ key ].woo_required ) { #>
<div class="notice notice-info" style="width: auto;">
<p class="wcf-learn-how">
Install/Activate WooCommerce to use this template.
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
<i class="dashicons dashicons-external"></i>
</a>
</p>
</div>
<# } else { #>
<a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>flow={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
<# } #>
</span>
<div class="template-id-container">
<h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
<div class="template-actions">
<#
if( data.items[ key ].page_builder.slug ) {
required_plugin_group = data.items[ key ].page_builder.slug;
} else {
required_plugin_group = '';
}
if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
import_btn_title = 'Import';
} else {
import_btn_title = 'Import';
} #>
<#
data.items[ key ].licence_status === 'valid';
if( data.items[ key ].licence_status && 'valid' ) { #>
<# if( ! data.items[ key ].woo_required ) { #>
<a data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
<# } else { #>
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
<# } #>
<# } #>
</div>
</div>
</div>
</div>
<# } #>
<# } #>
</script>
<?php
// Empty Step.
?>
<script type="text/template" id="tmpl-cartflows-create-blank-step">
<div class="inner">
<div class="template">
<span class="thumbnail site-preview cartflows-flow-preview">
<div class="template-screenshot">
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/start-scratch.jpg" />
</div>
<div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
</span>
<div class="template-id-container">
<h3 class="template-name"> Blank </h3>
<div class="template-actions">
<a href="#" class="button button-primary cartflows-step-import-blank"><?php esc_html_e( 'Create', 'cartflows' ); ?></a>
</div>
</div>
</div>
</div>
</script>
<?php
// Templates data.
?>
<script type="text/template" id="tmpl-cartflows-steps-list">
<# if ( data.items.length ) { #>
<# for ( key in data.items ) { #>
<#
var flow_steps = [];
if( data.items[ key ].flow_steps ) {
flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
return value['id'];
});
}
#>
<div class="inner">
<div class="template">
<span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
<div class="template-screenshot">
<# if( data.items[ key ].featured_image_url ) { #>
<img src="{{ data.items[ key ].featured_image_url }}" />
<# } else { #>
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
<# } #>
</div>
<div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
<#
data.items[ key ].licence_status === 'valid';
data.items[ key ].flow_type === 'pro';
if( data.items[ key ].woo_required ) { #>
<div class="notice notice-info" style="width: auto;">
<p class="wcf-learn-how">
Install/Activate WooCommerce to use this template.
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
<i class="dashicons dashicons-external"></i>
</a>
</p>
</div>
<# } else { #>
<a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>step={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
<# } #>
<# if( data.items[ key ].flow_type === 'pro') { #>
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
<# } #>
</span>
<div class="template-id-container">
<h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
<div class="template-actions">
<#
var step_slug = data.items[ key ].step_type.slug || '';
var step_title = data.items[ key ].step_type.name || '';
var import_btn_title = 'Import';
var required_plugin_group = '';
data.items[ key ].licence_status === 'valid';
data.items[ key ].flow_type === 'pro';
if( data.items[ key ].page_builder ) {
required_plugin_group = data.items[ key ].page_builder.slug;
if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
}
}
#>
<# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
<# if( ! data.items[ key ].woo_required ) { #>
<a data-slug="{{step_slug}}" data-title="{{step_title}}" data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
<# } else { #>
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
<# } #>
<# } #>
</div>
</div>
</div>
</div>
<# } #>
<# } #>
</script>