$('body').on('submit', '#user_edit', e => {
e.preventDefault();
$(e.currentTarget).validate({
rules: {
firstname: {
required: true,
},
lastname: {
required: true,
},
},
errorPlacement(error, element) {
if (element[0].localName === 'select') {
error.insertAfter($(element[0]).next());
}
else {
error.insertAfter(element);
}
}
});
})
$orders = [];
$usOrders = Project::where('status', '>', '2')->orderBy('status', 'desc')->get();
array_push($orders , $usOrders);
$allOrders = Project::where('status', '<', '3')->orderBy('created_at', 'desc')->get();
array_push($orders , $allOrderss);
public function show($id)
{
$dialog = Dialog::where('id', $id)->with('messages')->get();
foreach ($dialog[0]->messages as $key => $message) {
$message['user'] = $message->user;
}
return response()->json([
'success' => true,
'dialog' => $dialog
]);
}
const crop = $('.crop-image').croppie({
viewport: { width: 100, height: 100, type: 'circle' },
boundary: { width: '100%', height: 300 },
update(){
drawCroppedImage();
}
});
function drawCroppedImage(){
crop.croppie('result', {
type: 'rawcanvas',
size: {
width: 100,
height: 100
}
}).then(html => {
$('#cropped-image').html(html);
});
}
public function index(Request $request)
{
$city = $request->city;
$experience = $request->experience;
$type = $request->type;
$schedule = $request->schedule;
$jobs = Job::when($city, function ($query) use ($city) {
return $query->where('city', $city);
})
->when($type, function ($query) use ($type) {
return $query->where('type', $type);
})
->paginate(15);
return view('index')->with('jobs', $jobs);
}
$('[data-dropdown]').on('click', (e) => {
let dropdown = $(e.currentTarget).data('dropdown');
$(`#${dropdown}`).addClass('active');
})
$('body').on('click', (e) => {
if ( $(e.target).closest('.dropdown, [data-dropdown]').length == 0 ) {
$('.dropdown').removeClass('active')
}
})