add: full multi-tenancy control
This commit is contained in:
296
storage/framework/views/c88b70a8a9feab42ed2b012b4e9ee5c1.php
Executable file
296
storage/framework/views/c88b70a8a9feab42ed2b012b4e9ee5c1.php
Executable file
@@ -0,0 +1,296 @@
|
||||
<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag; ?>
|
||||
<?php foreach($attributes->onlyProps([
|
||||
'allowEdit' => true,
|
||||
]) as $__key => $__value) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
} ?>
|
||||
<?php $attributes = $attributes->exceptProps([
|
||||
'allowEdit' => true,
|
||||
]); ?>
|
||||
<?php foreach (array_filter(([
|
||||
'allowEdit' => true,
|
||||
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
} ?>
|
||||
<?php $__defined_vars = get_defined_vars(); ?>
|
||||
<?php foreach ($attributes as $__key => $__value) {
|
||||
if (array_key_exists($__key, $__defined_vars)) unset($$__key);
|
||||
} ?>
|
||||
<?php unset($__defined_vars); ?>
|
||||
|
||||
<v-inline-file-edit
|
||||
<?php echo e($attributes); ?>
|
||||
|
||||
:allow-edit="<?php echo e($allowEdit ? 'true' : 'false'); ?>"
|
||||
>
|
||||
<div class="group w-full max-w-full hover:rounded-sm">
|
||||
<div class="rounded-xs flex h-[34px] items-center pl-2.5 text-left">
|
||||
<div class="shimmer h-5 w-48 rounded border border-transparent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</v-inline-file-edit>
|
||||
|
||||
<?php if (! $__env->hasRenderedOnce('a4ebd6db-27fe-4c39-9efa-81954db40347')): $__env->markAsRenderedOnce('a4ebd6db-27fe-4c39-9efa-81954db40347');
|
||||
$__env->startPush('scripts'); ?>
|
||||
<script
|
||||
type="text/x-template"
|
||||
id="v-inline-file-edit-template"
|
||||
>
|
||||
<div class="group w-full max-w-full hover:rounded-sm">
|
||||
<!-- Non-editing view -->
|
||||
<div
|
||||
v-if="! isEditing"
|
||||
class="flex h-[34px] items-center justify-between rounded border border-transparent transition-all"
|
||||
:class="allowEdit ? 'hover:bg-gray-100 dark:hover:bg-gray-800' : ''"
|
||||
>
|
||||
<?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' => 'hidden',':id' => 'name',':name' => 'name','vModel' => 'inputValue']] + (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' => 'hidden',':id' => 'name',':name' => 'name','v-model' => 'inputValue']); ?>
|
||||
<?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; ?>
|
||||
|
||||
<a
|
||||
:href="inputValue"
|
||||
v-if="inputValue"
|
||||
target="_blank"
|
||||
>
|
||||
<span class="icon-download pl-[2px] text-2xl font-normal"></span>
|
||||
</a>
|
||||
|
||||
<span
|
||||
v-else
|
||||
class="icon-download cursor-pointer pl-[2px] text-2xl font-normal"
|
||||
>
|
||||
</span>
|
||||
|
||||
<template v-if="allowEdit">
|
||||
<i
|
||||
@click="toggle"
|
||||
class="icon-edit cursor-pointer rounded text-2xl opacity-0 hover:bg-gray-200 group-hover:opacity-100 dark:hover:bg-gray-950"
|
||||
></i>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Editing view -->
|
||||
<div
|
||||
class="relative flex w-full flex-col"
|
||||
v-else
|
||||
>
|
||||
<input
|
||||
type="file"
|
||||
:name="name"
|
||||
:id="name"
|
||||
:class="[errors.length ? 'border !border-red-600 hover:border-red-600' : '']"
|
||||
class="w-full rounded-md border px-3 py-2.5 text-sm text-gray-600 transition-all hover:border-gray-400 focus:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:file:bg-gray-800 dark:file:dark:text-white dark:hover:border-gray-400 dark:focus:border-gray-400"
|
||||
@change="handleChange"
|
||||
ref="input"
|
||||
/>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="absolute top-1/2 flex -translate-y-1/2 transform gap-0.5 ltr:right-2 rtl:left-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex items-center justify-center bg-green-100 p-1 hover:bg-green-200 ltr:rounded-l-md rtl:rounded-r-md"
|
||||
@click="save"
|
||||
>
|
||||
<i class="icon-tick text-md cursor-pointer font-bold text-green-600 dark:!text-green-600" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="flex items-center justify-center bg-red-100 p-1 hover:bg-red-200 ltr:rounded-r-md rtl:rounded-l-md"
|
||||
@click="cancel"
|
||||
>
|
||||
<i class="icon-cross-large text-md cursor-pointer font-bold text-red-600 dark:!text-red-600" />
|
||||
</button>
|
||||
</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' => 'name']] + (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' => 'name']); ?>
|
||||
<?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; ?>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="module">
|
||||
app.component('v-inline-file-edit', {
|
||||
template: '#v-inline-file-edit-template',
|
||||
|
||||
emits: ['on-change', 'on-cancelled'],
|
||||
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
value: {
|
||||
required: true,
|
||||
},
|
||||
|
||||
rules: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
label: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
position: {
|
||||
type: String,
|
||||
default: 'right',
|
||||
},
|
||||
|
||||
allowEdit: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
|
||||
errors: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
|
||||
url: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
inputValue: this.value,
|
||||
|
||||
isEditing: false,
|
||||
|
||||
file: null,
|
||||
|
||||
isRTL: document.documentElement.dir === 'rtl',
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
/**
|
||||
* Watch the value prop.
|
||||
*
|
||||
* @param {String} newValue
|
||||
*/
|
||||
value(newValue) {
|
||||
this.inputValue = newValue;
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Toggle the input.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
toggle() {
|
||||
this.isEditing = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Save the input value.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
save() {
|
||||
if (this.errors[this.name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isEditing = false;
|
||||
|
||||
let formData = new FormData();
|
||||
|
||||
formData.append(this.name, this.file);
|
||||
|
||||
formData.append('_method', 'PUT');
|
||||
|
||||
if (this.url) {
|
||||
this.$axios.post(this.url, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
this.$emitter.emit('add-flash', { type: 'success', message: response.data.message });
|
||||
})
|
||||
.catch((error) => {
|
||||
this.inputValue = this.value;
|
||||
|
||||
this.$emitter.emit('add-flash', { type: 'error', message: error.response.data.message });
|
||||
});
|
||||
}
|
||||
|
||||
this.$emit('on-change', {
|
||||
name: this.name,
|
||||
value: this.inputValue,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancel the input value.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
cancel() {
|
||||
this.inputValue = this.value;
|
||||
|
||||
this.isEditing = false;
|
||||
|
||||
this.$emit('on-cancelled', {
|
||||
name: this.name,
|
||||
value: this.inputValue,
|
||||
});
|
||||
},
|
||||
|
||||
handleChange(event) {
|
||||
this.file = event.target.files[0];
|
||||
|
||||
this.inputValue = URL.createObjectURL(this.file);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<?php $__env->stopPush(); endif; ?><?php /**PATH /var/www/html/packages/Webkul/Admin/src/Resources/views/components/form/control-group/controls/inline/file.blade.php ENDPATH**/ ?>
|
||||
Reference in New Issue
Block a user