Files
growup-crm/storage/framework/views/b9a9babe76c8328b3cfd9a0f6be97ac9.php
2026-02-02 15:31:15 -03:00

238 lines
14 KiB
PHP
Executable File

<?php if(isset($attribute)): ?>
<v-email-component
:attribute="<?php echo e(json_encode($attribute)); ?>"
:validations="'<?php echo e($validations); ?>'"
:value="<?php echo e(json_encode(old($attribute->code) ?? $value)); ?>"
>
<div class="mb-2 flex items-center">
<input
type="text"
class="w-full rounded rounded-r-none border border-gray-200 px-2.5 py-2 text-sm font-normal text-gray-800 hover:border-gray-400 focus:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:hover:border-gray-400 dark:focus:border-gray-400"
>
<div class="relative">
<select class="custom-select w-full rounded rounded-l-none border bg-white px-2.5 py-2 text-sm font-normal text-gray-800 hover:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:hover:border-gray-400 ltr:mr-6 ltr:pr-8 rtl:ml-6 rtl:pl-8">
<option value="work" selected><?php echo app('translator')->get('admin::app.common.custom-attributes.work'); ?></option>
<option value="home"><?php echo app('translator')->get('admin::app.common.custom-attributes.home'); ?></option>
</select>
</div>
</div>
<span class="flex cursor-pointer items-center gap-2 text-brandColor">
<i class="icon-add text-md !text-brandColor"></i>
<?php echo app('translator')->get("admin::app.common.custom-attributes.add-more"); ?>
</span>
</v-email-component>
<?php endif; ?>
<?php if (! $__env->hasRenderedOnce('afd0579e-88e1-4eca-ac07-92c183b385d4')): $__env->markAsRenderedOnce('afd0579e-88e1-4eca-ac07-92c183b385d4');
$__env->startPush('scripts'); ?>
<script
type="text/x-template"
id="v-email-component-template"
>
<template v-for="(email, index) in emails">
<div class="mb-2 flex items-center">
<?php if (isset($component)) { $__componentOriginal53af403f6b2179a3039d488b8ab2a267 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53af403f6b2179a3039d488b8ab2a267 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'admin::components.form.control-group.control','data' => ['type' => 'text',':id' => 'attribute.code',':name' => '`${attribute[\'code\']}[${index}][value]`','class' => 'rounded-r-none',':rules' => 'getValidation',':label' => 'attribute.name','vModel' => 'email[\'value\']',':disabled' => 'isDisabled']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin::form.control-group.control'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'text',':id' => 'attribute.code',':name' => '`${attribute[\'code\']}[${index}][value]`','class' => 'rounded-r-none',':rules' => 'getValidation',':label' => 'attribute.name','v-model' => 'email[\'value\']',':disabled' => 'isDisabled']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53af403f6b2179a3039d488b8ab2a267)): ?>
<?php $attributes = $__attributesOriginal53af403f6b2179a3039d488b8ab2a267; ?>
<?php unset($__attributesOriginal53af403f6b2179a3039d488b8ab2a267); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53af403f6b2179a3039d488b8ab2a267)): ?>
<?php $component = $__componentOriginal53af403f6b2179a3039d488b8ab2a267; ?>
<?php unset($__componentOriginal53af403f6b2179a3039d488b8ab2a267); ?>
<?php endif; ?>
<div class="relative">
<?php if (isset($component)) { $__componentOriginal53af403f6b2179a3039d488b8ab2a267 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53af403f6b2179a3039d488b8ab2a267 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'admin::components.form.control-group.control','data' => ['type' => 'select',':id' => 'attribute.code',':name' => '`${attribute[\'code\']}[${index}][label]`','class' => 'rounded-l-none ltr:mr-6 ltr:pr-8 rtl:ml-6 rtl:pl-8','rules' => 'required',':label' => 'attribute.name','vModel' => 'email[\'label\']',':disabled' => 'isDisabled']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin::form.control-group.control'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'select',':id' => 'attribute.code',':name' => '`${attribute[\'code\']}[${index}][label]`','class' => 'rounded-l-none ltr:mr-6 ltr:pr-8 rtl:ml-6 rtl:pl-8','rules' => 'required',':label' => 'attribute.name','v-model' => 'email[\'label\']',':disabled' => 'isDisabled']); ?>
<option value="work"><?php echo app('translator')->get('admin::app.common.custom-attributes.work'); ?></option>
<option value="home"><?php echo app('translator')->get('admin::app.common.custom-attributes.home'); ?></option>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53af403f6b2179a3039d488b8ab2a267)): ?>
<?php $attributes = $__attributesOriginal53af403f6b2179a3039d488b8ab2a267; ?>
<?php unset($__attributesOriginal53af403f6b2179a3039d488b8ab2a267); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53af403f6b2179a3039d488b8ab2a267)): ?>
<?php $component = $__componentOriginal53af403f6b2179a3039d488b8ab2a267; ?>
<?php unset($__componentOriginal53af403f6b2179a3039d488b8ab2a267); ?>
<?php endif; ?>
</div>
<i
v-if="emails.length > 1"
class="icon-delete ml-1 cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-100 dark:hover:bg-gray-950"
@click="remove(email)"
></i>
</div>
<?php if (isset($component)) { $__componentOriginal8da25fb6534e2ef288914e35c32417f8 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8da25fb6534e2ef288914e35c32417f8 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'admin::components.form.control-group.error','data' => [':name' => '`${attribute[\'code\']}[${index}][value]`']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin::form.control-group.error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([':name' => '`${attribute[\'code\']}[${index}][value]`']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8da25fb6534e2ef288914e35c32417f8)): ?>
<?php $attributes = $__attributesOriginal8da25fb6534e2ef288914e35c32417f8; ?>
<?php unset($__attributesOriginal8da25fb6534e2ef288914e35c32417f8); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8da25fb6534e2ef288914e35c32417f8)): ?>
<?php $component = $__componentOriginal8da25fb6534e2ef288914e35c32417f8; ?>
<?php unset($__componentOriginal8da25fb6534e2ef288914e35c32417f8); ?>
<?php endif; ?>
<?php if (isset($component)) { $__componentOriginal8da25fb6534e2ef288914e35c32417f8 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8da25fb6534e2ef288914e35c32417f8 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'admin::components.form.control-group.error','data' => [':name' => '`${attribute[\'code\']}[${index}].value`']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin::form.control-group.error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([':name' => '`${attribute[\'code\']}[${index}].value`']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8da25fb6534e2ef288914e35c32417f8)): ?>
<?php $attributes = $__attributesOriginal8da25fb6534e2ef288914e35c32417f8; ?>
<?php unset($__attributesOriginal8da25fb6534e2ef288914e35c32417f8); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8da25fb6534e2ef288914e35c32417f8)): ?>
<?php $component = $__componentOriginal8da25fb6534e2ef288914e35c32417f8; ?>
<?php unset($__componentOriginal8da25fb6534e2ef288914e35c32417f8); ?>
<?php endif; ?>
</template>
<span
class="flex w-fit cursor-pointer items-center gap-2 text-brandColor"
@click="add"
v-if="! isDisabled"
>
<i class="icon-add text-md !text-brandColor"></i>
<?php echo app('translator')->get("admin::app.common.custom-attributes.add-more"); ?>
</span>
</script>
<script type="module">
app.component('v-email-component', {
template: '#v-email-component-template',
props: ['validations', 'isDisabled', 'attribute', 'value'],
data() {
return {
emails: this.value || [{'value': '', 'label': 'work'}],
};
},
watch: {
value(newValue, oldValue) {
if (
JSON.stringify(newValue)
!== JSON.stringify(oldValue)
) {
this.emails = newValue || [{'value': '', 'label': 'work'}];
}
},
},
computed: {
getValidation() {
return {
email: true,
unique_email: this.emails ?? [],
...(this.validations === 'required' ? { required: true } : {}),
};
},
},
created() {
this.extendValidations();
},
methods: {
add() {
this.emails.push({
'value': '',
'label': 'work'
});
},
remove(email) {
this.emails = this.emails.filter(item => item !== email);
},
extendValidations() {
defineRule('unique_email', async (value, emails) => {
if (! value || ! value.length) {
return true;
}
const foundEmails = emails.filter(email => email.value === value).length;
if (foundEmails > 1) {
return 'This email is already in use.';
}
/**
* Check if the email is unique. This support is only for person emails only.
*/
if (this.attribute.code === 'person[emails]') {
try {
const { data } = await this.$axios.get('<?php echo e(route('admin.settings.attributes.check_unique_validation')); ?>', {
params: {
entity_id: this.attribute.id,
entity_type: 'persons',
attribute_code: 'emails',
attribute_value: value
}
});
if (! data.validated) {
return 'This email is already in use.';
}
return true;
} catch (error) {
console.error('Error checking email: ', error);
return 'Error validating email. Please try again.';
}
} else {
return true;
}
});
},
},
});
</script>
<?php $__env->stopPush(); endif; ?>
<?php /**PATH /var/www/html/packages/Webkul/Admin/src/Resources/views/components/attributes/edit/email.blade.php ENDPATH**/ ?>