<?php
/**
 * Thrive Themes - https://thrivethemes.com
 *
 * @package thrive-dashboard
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Silence is golden
}
?>

<div class="tvd-tss-modal-header">
	<h3 class="tvd-modal-title">
		<# if( model.get('type') ){ #>
			<?php echo __( 'Edit Field', TVE_DASH_TRANSLATE_DOMAIN ) ?>
		<# } else{ #>
			<?php echo __( 'Add Field', TVE_DASH_TRANSLATE_DOMAIN ) ?>
		<# } #>
	</h3>
</div>

<div class="tvd-modal-content tvd-tss-add">
	<div class="tvd-tss-group-wrapper">
		<p><?php _e( 'Which Group should this Global Field be added to?', TVE_DASH_TRANSLATE_DOMAIN ) ?> *</p>
		<div class="tvd-input-field">
			<div id="tvd-tss-group-name" data-field="group_id" class="tvd-complex-dropdown-trigger <#= Number( model.get( 'is_default' ) ) ? 'tvd-disabled' : '' #>">
				<# if( group.get('name') ){ #>
					<#= group.get('name') #>
				<# } else{ #>
					<?php echo __( 'Select the field group', TVE_DASH_TRANSLATE_DOMAIN ) ?>
				<# } #>
			</div>
			<label></label>
		</div>
		<div class="tvd-select-group-dropdown tvd-complex-dropdown-content tvd-hide">
			<div class="tvd-global-field-group-list"></div>
			<div id="tvd-add-new-group" class="tvd-add-new-group">
				<p>
					<span><?php dashboard_icon( 'plus-circle-regular' ); ?></span>
					<span><?php echo __( 'Add New Group', TVE_DASH_TRANSLATE_DOMAIN ) ?></span>
				</p>
			</div>

			<div id="tvd-input-new-group" class="tvd-save-new-group tvd-hide">
				<div class="tvd-input-field">
					<input id="tvd-add-group" data-field="name" type="text" value="" placeholder="Complete the group name">
					<label></label>
				</div>

				<div class="tvd-add-new-group" id="tvd-save-new-group">
					<p>
						<span><?php dashboard_icon( 'check-light' ); ?></span>
						<span><?php echo __( 'Save Group', TVE_DASH_TRANSLATE_DOMAIN ) ?></span>
					</p>
				</div>
			</div>
		</div>
	</div>
	<div class="tvd-tss-field-wrapper">
		<p><?php _e( 'What type of field is this?', TVE_DASH_TRANSLATE_DOMAIN ) ?> *</p>
		<div class="tvd-input-field">
			<div id="tvd-tss-field-type" data-field="type"
			     class=" tvd-complex-dropdown-trigger <#= model.get( 'default_field' )? 'tvd-disabled tvd-no-focus' : '' #>">
				<# if( model.get('type') ){ #>
					<i><#= SmartSite.data.fieldTypes[model.get('type')].icon #></i>
					<span><#= SmartSite.utils.get_field_type_name( parseInt( model.get('type') ) ) #></span>
				<# } else{ #>
					<?php echo __( 'Select the field type', TVE_DASH_TRANSLATE_DOMAIN ) ?>
				<# } #>
			</div>
		</div>
		<div class="tvd-select-type-dropdown tvd-complex-dropdown-content tvd-hide">
			<div class="tvd-global-field-type-list"></div>
		</div>
	</div>
	<div class="tvd-tss-field-data-wrapper"></div>
</div>

<div class="tvd-tss-modal-footer">
	<div class="tvd-tss-flex">
		<button class="tvd-btn-flat tvd-btn-flat-secondary tvd-btn-flat-dark tvd-waves-effect tvd-modal-close">
			<?php echo __( 'Cancel', TVE_DASH_TRANSLATE_DOMAIN ) ?>
		</button>
		<button class="tvd-btn tvd-btn-green tvd-waves-light tvd-right tvd-modal-submit tvd-tss-save-field" id="tvd-tss-save-field">
			<?php echo __( 'Save', TVE_DASH_TRANSLATE_DOMAIN ) ?>
		</button>
	</div>
</div>
