Files
sccs_laravel/resources/views/content/videos/create.blade.php
2025-11-04 16:23:40 +05:00

185 lines
9.2 KiB
PHP

@extends('layouts/contentLayoutMaster')
@section('title', 'Add Video')
@section('vendor-style')
<!-- vendor css files -->
<link rel="stylesheet" href="{{ asset(mix('vendors/css/extensions/toastr.min.css')) }}">
<link rel="stylesheet" href="{{ asset(mix('vendors/css/forms/select/select2.min.css')) }}">
@endsection
@section('page-style')
<!-- Page css files -->
<link rel="stylesheet" href="{{ asset(mix('css/base/plugins/extensions/ext-component-toastr.css')) }}">
@endsection
@section('content')
<section id="dropzone-examples">
<form action="{{ route('video.store') }}" name="usersForm" method="post" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Video Details</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="title-icon">Title</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="text"
id="title"
class="form-control @error('title') is-invalid @enderror"
name="title"
placeholder="e.g. Main Video"
value="{{ old('title') }}"
required
/>
@error('title')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<label for="category" class="form-label">Select Category</label>
<select name="category"
class="form-select select2 @error('category') is-invalid @enderror"
id="category">
@foreach($categories as $category)
<option value="{{$category->id}}">{{$category->name}}
</option>
@endforeach
</select>
@error('category')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row">
<div class="col-lg-6 col-sm-6">
<label for="type" class="form-label">Select Type</label>
<select name="type"
class="form-select select2 videoType @error('type') is-invalid @enderror"
id="type">
<option {{ old('type') === 'SERVER' ? 'selected' : '' }} value="SERVER">Server</option>
<option {{ old('type') === 'YOUTUBE' ? 'selected' : '' }} value="YOUTUBE">Youtube</option>
</select>
@error('type')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="url">Url</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="text"
id="url"
class="form-control @error('url') is-invalid @enderror"
name="url"
placeholder="e.g. http://google.com "
value="{{ old('url') }}"
/>
@error('url')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
<div class="row videoThumbnail">
<div class="col-lg-6 col-sm-6">
<div class="mb-1">
<label class="form-label" for="thumbnail">Thumbnail</label>
<div class="input-group input-group-merge">
<span class="input-group-text"><i data-feather="list"></i></span>
<input
type="file"
id="thumbnail"
class="form-control @error('thumbnail') is-invalid @enderror"
name="thumbnail"
value="{{ old('thumbnail') }}"
/>
@error('thumbnail')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-primary me-1"
onclick="this.disabled=true;this.form.submit();">Submit
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</section>
@endsection
@section('vendor-script')
<script src="{{ asset(mix('vendors/js/forms/cleave/cleave.min.js'))}}"></script>
<script src="{{ asset(mix('vendors/js/extensions/toastr.min.js')) }}"></script>
<script src="{{ asset(mix('vendors/js/forms/select/select2.full.min.js')) }}"></script>
@endsection
@section('page-script')
<script src="{{ asset(mix('js/scripts/forms/form-input-mask.js')) }}"></script>
<script src="{{ asset(mix('js/scripts/forms/form-select2.js')) }}"></script>
<script>
$(document).ready(function () {
toastr.options.timeOut = 10000;
@if(session()->has('error'))
toastr.error('{{ session('error') }}');
@elseif(session()->has('success'))
toastr.success('{{ session('success') }}');
@endif
$(".videoType").change(function(){
let value = (this).value;
if(value == 'YOUTUBE'){
$('.videoThumbnail').addClass('d-none');
$('#thumbnail'). prop('required',false);
}else{
$('.videoThumbnail').removeClass('d-none');
$('#thumbnail'). prop('required',true);
}
});
});
</script>
@endsection