git commit "fix: persianDatepicker did not initialize due to jQuery loading after content
This commit is contained in:
@@ -92,8 +92,6 @@ class FlightController extends Controller
|
|||||||
return view('admin.flights.edit',compact('flight'));
|
return view('admin.flights.edit',compact('flight'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function update(FlightStoreRequest $request, Flight $flight)
|
public function update(FlightStoreRequest $request, Flight $flight)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -128,6 +126,7 @@ class FlightController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['updated_by'] = auth('admin')->id();
|
||||||
|
|
||||||
$flight->update($data);
|
$flight->update($data);
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class TourController extends Controller
|
|||||||
->store('tours','public');
|
->store('tours','public');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$data['updated_by'] = auth('admin')->id();
|
||||||
|
|
||||||
$tour->update($data);
|
$tour->update($data);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Admin;
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Hekmatinasser\Verta\Verta;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
@@ -44,7 +45,21 @@ class FlightStoreRequest extends FormRequest
|
|||||||
'max:100'
|
'max:100'
|
||||||
],
|
],
|
||||||
'departure_date' => [
|
'departure_date' => [
|
||||||
'required'
|
'required',
|
||||||
|
function ($attribute, $value, $fail) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
$gregorian = Verta::parse($value)
|
||||||
|
->formatGregorian('Y-m-d');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$fail('تاریخ حرکت معتبر نیست.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($gregorian < now()->format('Y-m-d')) {
|
||||||
|
$fail('تاریخ حرکت نمیتواند قبل از تاریخ امروز باشد.');
|
||||||
|
}
|
||||||
|
},
|
||||||
],
|
],
|
||||||
'departure_time' => [
|
'departure_time' => [
|
||||||
'required',
|
'required',
|
||||||
@@ -69,7 +84,7 @@ class FlightStoreRequest extends FormRequest
|
|||||||
'min:0'
|
'min:0'
|
||||||
],
|
],
|
||||||
'image' => [
|
'image' => [
|
||||||
'required',
|
$this->isMethod('put') || $this->isMethod('patch') ? 'nullable' : 'required',
|
||||||
'image',
|
'image',
|
||||||
'mimes:jpg,jpeg,png,webp',
|
'mimes:jpg,jpeg,png,webp',
|
||||||
'max:2048'
|
'max:2048'
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Admin;
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Hekmatinasser\Verta\Verta;
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ class TourStoreRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,7 +24,64 @@ class TourStoreRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
//
|
'title' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'max:150'
|
||||||
|
],
|
||||||
|
'travel_type_id' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'exists:travel_types,id'
|
||||||
|
],
|
||||||
|
'summary' => [
|
||||||
|
'nullable',
|
||||||
|
'string',
|
||||||
|
'max:255'
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'nullable',
|
||||||
|
'string'
|
||||||
|
],
|
||||||
|
'price' => [
|
||||||
|
'required',
|
||||||
|
'numeric',
|
||||||
|
'min:0'
|
||||||
|
],
|
||||||
|
'departure_date' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
function ($attribute, $value, $fail) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
$gregorian = Verta::parse($value)
|
||||||
|
->formatGregorian('Y-m-d');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$fail('تاریخ حرکت معتبر نیست.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($gregorian < now()->format('Y-m-d')) {
|
||||||
|
$fail('تاریخ حرکت نمیتواند قبل از تاریخ امروز باشد.');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'image' => [
|
||||||
|
$this->isMethod('put') || $this->isMethod('patch') ? 'nullable' : 'required',
|
||||||
|
'image',
|
||||||
|
'mimes:jpg,jpeg,png,webp',
|
||||||
|
'max:2048'
|
||||||
|
],
|
||||||
|
'views' => [
|
||||||
|
'nullable',
|
||||||
|
'integer',
|
||||||
|
'min:0'
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'required',
|
||||||
|
'in:0,1,2'
|
||||||
|
]
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+10
File diff suppressed because one or more lines are too long
+12
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -164,10 +164,14 @@
|
|||||||
تاریخ حرکت پرواز
|
تاریخ حرکت پرواز
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|
||||||
<input type="text"
|
<input type="text"
|
||||||
id="departure_date"
|
id="departure_date"
|
||||||
name="departure_date"
|
name="departure_date"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
readonly
|
||||||
|
autocomplete="off"
|
||||||
|
value="{{ old('departure_date') }}"
|
||||||
placeholder="انتخاب تاریخ حرکت">
|
placeholder="انتخاب تاریخ حرکت">
|
||||||
|
|
||||||
@error('departure_date')
|
@error('departure_date')
|
||||||
@@ -177,8 +181,6 @@
|
|||||||
@enderror
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
@@ -291,11 +293,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
window.addEventListener('load', function () {
|
||||||
$("#departure_date").persianDatepicker({
|
$("#departure_date").persianDatepicker({
|
||||||
format: 'YYYY/MM/DD',
|
format: 'YYYY/MM/DD',
|
||||||
autoClose: true,
|
autoClose: true,
|
||||||
initialValue: false,
|
initialValue: false,
|
||||||
minDate: new persianDate()
|
minDate: new persianDate()
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -142,8 +142,14 @@
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
id="departure_date"
|
id="departure_date"
|
||||||
name="departure_date"
|
name="departure_date"
|
||||||
class="form-control">
|
class="form-control"
|
||||||
{{ verta($flight->departure_date)->format('Y/m/d') }}
|
readonly
|
||||||
|
autocomplete="off"
|
||||||
|
value="{{ old('departure_date', $flight->departure_date ? verta($flight->departure_date)->format('Y/m/d') : '') }}">
|
||||||
|
|
||||||
|
@error('departure_date')
|
||||||
|
<div class="text-danger mt-2">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -205,7 +211,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
@@ -235,11 +240,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
window.addEventListener('load', function () {
|
||||||
$("#departure_date").persianDatepicker({
|
$("#departure_date").persianDatepicker({
|
||||||
format: 'YYYY/MM/DD',
|
format: 'YYYY/MM/DD',
|
||||||
autoClose: true,
|
autoClose: true,
|
||||||
initialValue: false,
|
initialValue: false,
|
||||||
minDate: new persianDate()
|
minDate: new persianDate()
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
<div>
|
|
||||||
<!-- Happiness is not something readymade. It comes from your own actions. - Dalai Lama -->
|
|
||||||
</div>
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
@endisset
|
@endisset
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/persian-datepicker@1.2.0/dist/css/persian-datepicker.min.css">
|
<link rel="stylesheet" href="{{asset('assets/admin/persian-datepicker.min.css')}}">
|
||||||
<link href="{{asset('assets/bootstrap-5.3.8-examples/assets/dist/css/bootstrap.rtl.min.css')}}" rel="stylesheet">
|
<link href="{{asset('assets/bootstrap-5.3.8-examples/assets/dist/css/bootstrap.rtl.min.css')}}" rel="stylesheet">
|
||||||
<link href="{{ asset('assets/admin/css/style.css') }}" rel="stylesheet">
|
<link href="{{ asset('assets/admin/css/style.css') }}" rel="stylesheet">
|
||||||
|
|
||||||
@@ -38,8 +38,8 @@
|
|||||||
@includeUnless(isset($rawLayout),'admin.layouts.footer')
|
@includeUnless(isset($rawLayout),'admin.layouts.footer')
|
||||||
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
<script src="{{asset('assets/js/jquery-3.7.1.min.js')}}"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/persian-date@1.1.0/dist/persian-date.min.js"></script>
|
<script src="{{asset('assets/js/persian-date.min.js')}}"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/persian-datepicker@1.2.0/dist/js/persian-datepicker.min.js"></script>
|
<script src="{{asset('assets/js/persian-datepicker.min.js')}}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -154,12 +154,13 @@
|
|||||||
id="departure_date"
|
id="departure_date"
|
||||||
name="departure_date"
|
name="departure_date"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
readonly
|
||||||
|
autocomplete="off"
|
||||||
|
value="{{ old('departure_date') }}"
|
||||||
placeholder="انتخاب تاریخ حرکت">
|
placeholder="انتخاب تاریخ حرکت">
|
||||||
|
|
||||||
@error('departure_date')
|
@error('departure_date')
|
||||||
<div class="text-danger mt-2">
|
<div class="text-danger mt-2">{{ $message }}</div>
|
||||||
{{ $message }}
|
|
||||||
</div>
|
|
||||||
@enderror
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -230,16 +231,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#start_date").persianDatepicker({
|
window.addEventListener('load', function () {
|
||||||
|
$("#departure_date").persianDatepicker({
|
||||||
format: 'YYYY/MM/DD',
|
format: 'YYYY/MM/DD',
|
||||||
|
|
||||||
autoClose: true,
|
autoClose: true,
|
||||||
|
|
||||||
initialValue: false,
|
initialValue: false,
|
||||||
|
|
||||||
minDate: new persianDate()
|
minDate: new persianDate()
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -111,15 +111,20 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text"
|
<input type="text"
|
||||||
id="start_date"
|
id="departure_date"
|
||||||
name="start_date"
|
name="departure_date"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="انتخاب تاریخ حرکت">
|
readonly
|
||||||
{{ verta($tour->departure_date)->format('Y/m/d') }}
|
autocomplete="off"
|
||||||
|
value="{{ old('departure_date', $tour->departure_date ? verta($tour->departure_date)->format('Y/m/d') : '') }}">
|
||||||
|
|
||||||
|
@error('departure_date')
|
||||||
|
<div class="text-danger mt-2">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
|
|
||||||
<label>وضعیت</label>
|
<label>وضعیت</label>
|
||||||
@@ -192,17 +197,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#start_date").persianDatepicker({
|
window.addEventListener('load', function () {
|
||||||
|
$("#departure_date").persianDatepicker({
|
||||||
format: 'YYYY/MM/DD',
|
format: 'YYYY/MM/DD',
|
||||||
|
|
||||||
autoClose: true,
|
autoClose: true,
|
||||||
|
|
||||||
initialValue: false,
|
initialValue: false,
|
||||||
|
|
||||||
minDate: new persianDate()
|
minDate: new persianDate()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
<div>
|
|
||||||
<!-- Happiness is not something readymade. It comes from your own actions. - Dalai Lama -->
|
|
||||||
</div>
|
|
||||||
Reference in New Issue
Block a user