<?php
if(!defined('ABSPATH')) exit;
$bizcalendar_web_key = basename(__FILE__, '.php');
$bizcalendar_web_mandatoryEmail = (bool)get_option('setrio_bizcal_mandatory_email', false);
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$args['key'] = $bizcalendar_web_key;
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$args['wargs'] = array_replace((isset($args['wargs']) ? $args['wargs'] : array()), array(
	'label' => setrio_bizcal_message('lblPatientEmail'),
	'texts' => array(
		'invalid' => setrio_bizcal_message('lblEmailFieldNotValid'),
        'required' => setrio_bizcal_message('lblFieldMissing') . ' ' . setrio_bizcal_message('lblPatientEmail'),
	),
	'rules' => "[
        v => " . ($bizcalendar_web_mandatoryEmail ? 'false' : 'true') . " || (!!v && !!v.trim().length) || objVal(\$data,'texts." . $bizcalendar_web_key . ".required') || '',
		v => !v || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(v) || objVal(\$data,'texts." . $bizcalendar_web_key . ".invalid') || '',
	]",
));

setrio_bizcal_get_template_part('vue/part/text', $args);