227 lines
12 KiB
PHP
227 lines
12 KiB
PHP
<div x-data="{ showVideo: '{{ isset($gallery) && $gallery->galleryCategory->type == 'video' ? true : false }}', categoryType: '{{ $gallery->galleryCategory->type ?? '' }}' }">
|
|
<div class="row mb-4">
|
|
<div class="card-body pt-0 p-2">
|
|
<div class="type d-flex gap-4 mb-2 align-items-center mx-2">
|
|
<!-- Image checkbox -->
|
|
<div class="gallery-image">
|
|
<input type="radio" id="imageRadio" name="type" value="image" x-on:click="showVideo = false"
|
|
x-bind:disabled="categoryType === 'video'"
|
|
{{ (isset($gallery) && $gallery->galleryCategory->type) !== 'video' ? 'x-bind:checked="!showVideo"' : '' }}>
|
|
<label for="imageRadio">Image</label><br>
|
|
</div>
|
|
<!-- Video checkbox -->
|
|
<div class="gallery-video">
|
|
<input type="radio" id="gallery-video" name="type" value="video" placeholder=""
|
|
x-on:click="showVideo = true" x-bind:disabled="categoryType === 'image'"
|
|
{{ isset($gallery) && $gallery->galleryCategory->type == 'video' ? 'x-bind:checked="showVideo"' : '' }}>
|
|
<label for="gallery-video">Video</label><br>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{-- Image --}}
|
|
<template x-if="!showVideo || (categoryType === 'image' && !showVideo)">
|
|
<div>
|
|
<div id="image-content" class="d-flex align-items-start align-items-sm-center gap-4">
|
|
<img src="{{ asset(!empty($gallery->image_path) ? 'storage/uploads/' . $gallery->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
|
alt="banner-image input-file" class="d-block rounded show-image" height="100"
|
|
width="100" />
|
|
|
|
<div class="button-wrapper">
|
|
<label for="upload" class="btn btn-primary me-2 mb-4" tabindex="0">
|
|
<span class="d-none d-sm-block">Upload</span>
|
|
<i class="bx bx-upload d-block d-sm-none"></i>
|
|
<input type="file" id="upload" class="input-file" name="image" hidden
|
|
accept="image/png, image/jpeg" />
|
|
</label>
|
|
<button type="button" class="btn btn-label-secondary image-reset mb-4">
|
|
<i class="bx bx-reset d-block d-sm-none"></i>
|
|
<span class="d-none d-sm-block">Reset</span>
|
|
</button>
|
|
|
|
<p class="mb-0">Allowed JPG, GIF or PNG. Max size of 3Mb</p>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-name">Photo /Video Short Information</label>
|
|
<input type="text" class="form-control" name="detail"
|
|
value="{{ old('detail', $gallery->detail ?? '') }}" placeholder="e.g. Himalayas, Nepal"
|
|
required />
|
|
@error('detail')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-company">Status</label>
|
|
<select class="select2 form-select" id="basic-default-company select2Basic"
|
|
aria-label="Default select example" name="status" required>
|
|
<option value="active"{{ ($gallery->status ?? '') == 'active' ? 'selected' : '' }}>
|
|
Active</option>
|
|
<option value="inactive"{{ ($gallery->status ?? '') == 'inactive' ? 'selected' : '' }}>
|
|
Inactive
|
|
</option>
|
|
</select>
|
|
@error('status')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-name">Select Or Insert Category</label>
|
|
<input type="text" list="categories" class="form-control"
|
|
value="{{ old('category', isset($gallery) ? $gallery->galleryCategory->category : '') }}"
|
|
name="category" id="basic-default-name" />
|
|
@error('category')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
|
|
<template x-if="!showVideo || (categoryType === 'image' && !showVideo)">
|
|
{{-- image --}}
|
|
<datalist id="categories">
|
|
@foreach ($galleryCategories ?? [] as $galleryCategory)
|
|
@if ($galleryCategory->type == 'image')
|
|
<option value="{{ $galleryCategory->category }}">
|
|
{{ $galleryCategory->category }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</datalist>
|
|
</template>
|
|
|
|
{{-- video --}}
|
|
{{-- <template x-if="showVideo">
|
|
<div>
|
|
<datalist id="categories">
|
|
@foreach ($galleryCategories ?? [] as $galleryCategory)
|
|
@if ($galleryCategory->type == 'video')
|
|
<option value="{{ $galleryCategory->category }}">
|
|
{{ $galleryCategory->category }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</datalist>
|
|
</div>
|
|
</template> --}}
|
|
</div>
|
|
{{-- <div>
|
|
<button type="submit" class="btn btn-primary">
|
|
@if (empty($gallery))
|
|
Save Gallery
|
|
@else
|
|
Update Gallery
|
|
@endif
|
|
</button>
|
|
</div> --}}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
{{-- Video --}}
|
|
<template x-if="showVideo || (categoryType === 'video' && !showVideo)">
|
|
<div>
|
|
<label class="form-label" for="videoLink">Video link</label>
|
|
<input type="text" class="form-control" id="videoLink" name="video_link"
|
|
value="{{ old('video_link', isset($gallery) ? $gallery->video_link : '') }}"
|
|
placeholder="Eg. https://www.youtube.com/watch?v=NbFJ8W8L-3s" />
|
|
@error('video_link')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
|
|
<div class="row">
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-name">Photo /Video Short Information</label>
|
|
<input type="text" class="form-control" name="detail"
|
|
value="{{ old('detail', $gallery->detail ?? '') }}" placeholder="e.g. Himalayas, Nepal"
|
|
required />
|
|
@error('detail')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-company">Status</label>
|
|
<select class="select2 form-select" id="basic-default-company select2Basic"
|
|
aria-label="Default select example" name="status" required>
|
|
<option value="active"{{ ($gallery->status ?? '') == 'active' ? 'selected' : '' }}>
|
|
Active</option>
|
|
<option
|
|
value="inactive"{{ ($gallery->status ?? '') == 'inactive' ? 'selected' : '' }}>
|
|
Inactive
|
|
</option>
|
|
</select>
|
|
@error('status')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="mb-3 col-md-6">
|
|
<label class="form-label" for="basic-default-name">Select Or Insert Category</label>
|
|
<input type="text" list="categories" class="form-control"
|
|
value="{{ old('category', isset($gallery) ? $gallery->galleryCategory->category : '') }}"
|
|
name="category" id="basic-default-name" />
|
|
@error('category')
|
|
<div class="text-danger">{{ $message }}</div>
|
|
@enderror
|
|
|
|
{{-- image --}}
|
|
{{-- <template x-if="!showVideo">
|
|
<datalist id="categories">
|
|
@foreach ($galleryCategories ?? [] as $galleryCategory)
|
|
@if ($galleryCategory->type == 'image')
|
|
<option value="{{ $galleryCategory->category }}">
|
|
{{ $galleryCategory->category }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</datalist>
|
|
</template> --}}
|
|
|
|
|
|
<template x-if="showVideo || (categoryType === 'video' && !showVideo)">
|
|
<div>
|
|
{{-- video --}}
|
|
<datalist id="categories">
|
|
@foreach ($galleryCategories ?? [] as $galleryCategory)
|
|
@if ($galleryCategory->type == 'video')
|
|
<option value="{{ $galleryCategory->category }}">
|
|
{{ $galleryCategory->category }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</datalist>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
{{-- <div>
|
|
<button type="submit" class="btn btn-primary">
|
|
@if (empty($gallery))
|
|
Save Gallery
|
|
@else
|
|
Update Gallery
|
|
@endif
|
|
</button>
|
|
</div> --}}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<div>
|
|
<button type="submit" class="btn btn-primary">
|
|
{{ !isset($gallery->id) ? 'Save Gallery' : 'Update Gallery' }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<hr class="my-0" />
|
|
</div>
|
|
|
|
|
|
|
|
@push('required-styles')
|
|
@include('admin::vendor.select2.style')
|
|
@endpush
|
|
|
|
@push('required-scripts')
|
|
@include('admin::vendor.select2.script')
|
|
@endpush
|