Commit 44447295 by Arpit Jain

implemented admin panel

parent 25cbe9d8
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Admin\AdminController;
use App\LocaterFeed;
use DB;
use Validator;
use Illuminate\Support\Facades\Hash;
class FeedController extends AdminController
{
const RECORD_PER_PAGE = 10;
public function __construct()
{
$this->middleware('auth');
}
public function feedsList(Request $request) {
$admin_id = $request->session()->get('id');
$pageNo = trim($request->input('page', 1));
DB::enableQueryLog();
$keyword = strtolower(trim($request->input('keyword')));
$feedList = LocaterFeed::where('locater_feeds.is_deleted', '=', '0');
$count = LocaterFeed::where('locater_feeds.is_deleted', '=', '0')->count();
if($keyword)
{
$feedList = $feedList->where(function ($query) use ($keyword) {
$query->orwhere('locater_feeds.title', 'like', '%'.$keyword);
});
}
$this->data['records'] = $feedList->sortable(['id'=>'desc'])->paginate(Self::RECORD_PER_PAGE);
$queries = DB::getQueryLog();
return view('admin.feeds.feeds_mng', ['data' => $this->data,'pageNo' => @$pageNo, 'record_per_page' => Self::RECORD_PER_PAGE,'request'=>$request]);
}
public function createFeed(){
return view('admin.feeds.add');
}
public function saveFeed(Request $request) {
$user_id = auth()->user('id');
if ($request->all()) {
$feeds_id = trim($request->feeds_id);
$title = trim($request->title);
$description = trim($request->description);
$gtin = trim($request->gtin);
$brand = trim($request->brand);
$color = trim($request->color);
$size = trim($request->size);
$link = trim($request->link);
$image_link = trim($request->image_link);
$availability = trim($request->availability);
$product_condition = trim($request->product_condition);
$item_group_id = trim($request->item_group_id);
$google_product_category = trim($request->google_product_category);
$product_type = trim($request->product_type);
$sale_price = trim($request->sale_price);
$price = trim($request->price);
$status = trim($request->status);
$validator = Validator::make($request->all(), [
'feeds_id' => 'required',
'title' => 'required',
'description' => 'required',
'gtin' => 'required',
'brand' => 'required',
'color' => 'required',
'size' => 'required',
'link' => 'required',
'image_link' => 'required',
'availability' => 'required',
'product_condition' => 'required',
'item_group_id' => 'required',
'google_product_category' => 'required',
'product_type' => 'required',
'sale_price' => 'required',
'price' => 'required',
'status' => 'required',
]);
if ($validator->fails())
{
return redirect()->route('admin.feeds.add')
->withErrors($validator)
->withInput();
}
else
{
$feed = new LocaterFeed;
$feed->feeds_id = $feeds_id;
$feed->title = $title;
$feed->description = $description;
$feed->gtin = $gtin;
$feed->brand = $brand;
$feed->color = $color;
$feed->size = $size;
$feed->link = $link;
$feed->image_link = $image_link;
$feed->availability = $availability;
$feed->product_condition = $product_condition;
$feed->item_group_id = $item_group_id;
$feed->google_product_category = $google_product_category;
$feed->product_type = $product_type;
$feed->sale_price = $sale_price;
$feed->price = $price;
$feed->status = $status;
$feed->save();
$msg = 'Feed has been added successfully.';
$request->session()->flash('add_message', $msg);
return redirect()->route('admin.feeds');
}
}
}
public function editFeed(Request $request, $id){
if(!empty($id)){
$data = LocaterFeed::find($id);
}
return view('admin.feeds.edit', compact(array('data')));
}
public function updateFeed(Request $request, $id) {
$user_id = auth()->user('id');
$data = array();
if(!empty($id)){
$data = LocaterFeed::find($id);
}
if ($request->all()) {
$feeds_id = trim($request->feeds_id);
$title = trim($request->title);
$description = trim($request->description);
$gtin = trim($request->gtin);
$brand = trim($request->brand);
$color = trim($request->color);
$size = trim($request->size);
$link = trim($request->link);
$image_link = trim($request->image_link);
$availability = trim($request->availability);
$product_condition = trim($request->product_condition);
$item_group_id = trim($request->item_group_id);
$google_product_category = trim($request->google_product_category);
$product_type = trim($request->product_type);
$sale_price = trim($request->sale_price);
$price = trim($request->price);
$status = trim($request->status);
$validator = Validator::make($request->all(), [
'feeds_id' => 'required',
'title' => 'required',
'description' => 'required',
'gtin' => 'required',
'brand' => 'required',
'color' => 'required',
'size' => 'required',
'link' => 'required',
'image_link' => 'required',
'availability' => 'required',
'product_condition' => 'required',
'item_group_id' => 'required',
'google_product_category' => 'required',
'product_type' => 'required',
'sale_price' => 'required',
'price' => 'required',
'status' => 'required',
]);
if ($validator->fails()) {
return redirect()->route('admin.feeds.edit',['id'=>$id])
->withErrors($validator)
->withInput();
} else {
$feed = LocaterFeed::find($id);
$feed->feeds_id = $feeds_id;
$feed->title = $title;
$feed->description = $description;
$feed->gtin = $gtin;
$feed->brand = $brand;
$feed->color = $color;
$feed->size = $size;
$feed->link = $link;
$feed->image_link = $image_link;
$feed->availability = $availability;
$feed->product_condition = $product_condition;
$feed->item_group_id = $item_group_id;
$feed->google_product_category = $google_product_category;
$feed->product_type = $product_type;
$feed->sale_price = $sale_price;
$feed->price = $price;
$feed->status = $status;
$feed->save();
$msg = 'Feed has been updated successfully.';
$request->session()->flash('add_message', $msg);
return redirect()->route('admin.feeds');
}
}
else {
return view('admin.feeds.add', ['data' => $data, 'request' => $request]);
}
}
public function deleteFeed($id, Request $request) {
if ($id) {
$feed = LocaterFeed::find($id);
$feed->is_deleted = '1';
if($feed->save()){
$msg = 'Feed has been deleted successfully.';
$request->session()->flash('message', $msg);
}
}
return redirect()->route('admin.feeds');
}
}
\ No newline at end of file
......@@ -179,6 +179,11 @@ return [
'url' => 'admin/offers',
'icon_color' => 'aqua',
],
[
'text' => 'Manage Feeds',
'url' => 'admin/feeds',
'icon_color' => 'aqua',
],
'SETTINGS',
[
'text' => 'Manage Home Page',
......
@extends('adminlte::page')
@section('content')
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Locater</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Create Feed</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Horizontal Form -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"></h3>
<div class="alert alert-success alert-dismissible groputitle" style="display:none">
</div>
@if(Session::has('add_message'))
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{!! session('add_message') !!}
</div>
@endif
<form class="form-horizontal" id="add-feedform" action="{{route('admin.feeds.save')}}" method="POST" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="box-body">
<div class="form-group @if($errors->first('feeds_id')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Feed ID<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="feeds_id" class="form-control" placeholder="Feed ID">
<?php if(@$errors->first('feeds_id')) { ?> <span class="help-block">{{@$errors->first('feeds_id')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('title')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Title<em>*</em></label>
<div class="col-sm-6">
<input type="text" name="title" class="form-control" placeholder="Title">
<?php if(@$errors->first('title')) { ?> <span class="help-block">{{@$errors->first('title')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('description')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" id="description" name="description">
<?php if(isset($data->description) && !empty($data->description)){ ?>
{{$data->description}}
<?php } ?>
</textarea>
</div>
</div>
<div class="form-group @if($errors->first('gtin')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Gtin<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="gtin" class="form-control" placeholder="gtin">
<?php if(@$errors->first('gtin')) { ?> <span class="help-block">{{@$errors->first('gtin')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('brand')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Brand<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="brand" class="form-control" placeholder="brand">
<?php if(@$errors->first('brand')) { ?> <span class="help-block">{{@$errors->first('brand')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('color')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Color<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="color" class="form-control" placeholder="color">
<?php if(@$errors->first('color')) { ?> <span class="help-block">{{@$errors->first('color')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('size')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Size<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="size" class="form-control" placeholder="size">
<?php if(@$errors->first('size')) { ?> <span class="help-block">{{@$errors->first('size')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('link')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Link<em>*</em></label>
<div class="col-sm-6">
<input type="textarea" name="link" class="form-control" placeholder="link">
<?php if(@$errors->first('link')) { ?> <span class="help-block">{{@$errors->first('link')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('image_link')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Image Link<em>*</em></label>
<div class="col-sm-6">
<input type="textarea" name="image_link" class="form-control" placeholder="image_link">
<?php if(@$errors->first('image_link')) { ?> <span class="help-block">{{@$errors->first('image_link')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('availability')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Availability<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('in stock'=>'In stock'); ?>
<select name="availability" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
@endforeach
</select>
</div>
</div>
<div class="form-group @if($errors->first('product_condition')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Product Condition<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('NEW'=>'NEW'); ?>
<select name="product_condition" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
@endforeach
</select>
</div>
</div>
<div class="form-group @if($errors->first('item_group_id')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Item Group Id<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="item_group_id" class="form-control" placeholder="item_group_id">
<?php if(@$errors->first('item_group_id')) { ?> <span class="help-block">{{@$errors->first('item_group_id')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('google_product_category')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Google Product Category<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="google_product_category" class="form-control" placeholder="google_product_category">
<?php if(@$errors->first('google_product_category')) { ?> <span class="help-block">{{@$errors->first('google_product_category')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('product_type')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Product Type<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="product_type" class="form-control" placeholder="product_type">
<?php if(@$errors->first('product_type')) { ?> <span class="help-block">{{@$errors->first('product_type')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('sale_price')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Sale Price<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="sale_price" class="form-control" placeholder="sale_price">
<?php if(@$errors->first('sale_price')) { ?> <span class="help-block">{{@$errors->first('sale_price')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('price')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Price<em>*</em></label>
<div class="col-sm-4">
<input type="textarea" name="price" class="form-control" placeholder="price">
<?php if(@$errors->first('price')) { ?> <span class="help-block">{{@$errors->first('price')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('status')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Status<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('1'=>'Active','0'=>'In Active'); ?>
<select name="status" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
@endforeach
</select>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<input type="submit" value="Submit" class="btn btn-info">
<a href="{{route('admin.feeds')}}" class="btn btn-default">Cancel</a>
</div>
<!-- /.box-footer -->
</form>
</div>
</div>
<!--/.col (right) -->
</div>
</div>
</div>
<style>
.help-block{
color:red;
}
.error{
color:red;
}
</style>
<script type="text/javascript">
$( document ).ready(function() {
$.validator.addMethod('filesize', function(value, element, param) {
return this.optional(element) || (element.files[0].size <= param)
});
$.validator.addMethod("alphanumspecial", function (value, element) {
return this.optional(element) || /^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{6,})/i.test(value);
}, "Combination of alphabets,special characters & numeric values required.");
$('#add-feedform').validate({
ignore: ".ignore",
rules: {
feeds_id: "required",
title: "required",
description: "required",
gtin: "required",
brand: "required",
color: "required",
size: "required",
link: "required",
image_link: "required",
availability: "required",
product_condition: "required",
item_group_id: "required",
google_product_category: "required",
product_type: "required",
sale_price: "required",
price: "required",
status: "required",
},
// Specify validation error messages
messages: {
feeds_id:"Please enter Feed ID.",
title:"Please enter Titale.",
description: "Please enter Description.",
gtin: "Please enter Gtin.",
brand: "Please enter Brand.",
color: "Please enter Color",
size: "Please enter Size.",
link: "Please enter Link.",
image_link: "Please enter Image Link.",
availability: "Please select availabilty.",
product_condition: "Please select Product Condition.",
item_group_id: "Please enter Item Group Id.",
google_product_category: "Please enter Google Product Category.",
product_type: "Please enter Product Type",
sale_price: "Please enter Sale Price.",
price: "Please enter Price.",
status: "Please select status."
},
});
});
</script>
<script src="{{ asset('/vendor/unisharp/laravel-ckeditor/ckeditor.js') }}"></script>
<script>
CKEDITOR.replace( 'description' );
</script>
@endsection
\ No newline at end of file
@extends('adminlte::page')
@section('content')
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Feed</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Update Feed</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Horizontal Form -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"></h3>
<div class="alert alert-success alert-dismissible groputitle" style="display:none">
</div>
@if(Session::has('add_message'))
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{!! session('add_message') !!}
</div>
@endif
<form class="form-horizontal" id="add-feedform" action="{{route('admin.feeds.update',['id'=>@$data->id])}}" method="POST" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="box-body">
<input type="hidden" name="id" value="{{old('id',@$data->id)}}">
<div class="form-group @if($errors->first('feeds_id')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Feed ID<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="feeds_id" class="form-control" placeholder="Locater ID" value="{{old('feeds_id',@$data->feeds_id)}}">
<?php if(@$errors->first('feeds_id')) { ?> <span class="help-block">{{@$errors->first('feeds_id')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('title')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Title<em>*</em></label>
<div class="col-sm-6">
<input type="text" name="title" class="form-control" placeholder="Locater ID" value="{{old('title',@$data->title)}}">
<?php if(@$errors->first('title')) { ?> <span class="help-block">{{@$errors->first('title')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('description')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" id="description" name="description">
<?php if(isset($data->description) && !empty($data->description)){ ?>
{{$data->description}}
<?php } ?>
</textarea>
</div>
</div>
<div class="form-group @if($errors->first('gtin')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Gtin<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="gtin" class="form-control" placeholder="Gtin" value="{{old('gtin',@$data->gtin)}}">
<?php if(@$errors->first('gtin')) { ?> <span class="help-block">{{@$errors->first('gtin')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('brand')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Brand<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="brand" class="form-control" placeholder="Brand" value="{{old('brand',@$data->brand)}}">
<?php if(@$errors->first('brand')) { ?> <span class="help-block">{{@$errors->first('brand')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('color')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Color<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="color" class="form-control" placeholder="Color" value="{{old('color',@$data->color)}}">
<?php if(@$errors->first('color')) { ?> <span class="help-block">{{@$errors->first('color')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('size')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Size<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="size" class="form-control" placeholder="Size" value="{{old('size',@$data->size)}}">
<?php if(@$errors->first('size')) { ?> <span class="help-block">{{@$errors->first('size')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('link')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Link<em>*</em></label>
<div class="col-sm-6">
<input type="text" name="link" class="form-control" placeholder="Link" value="{{old('link',@$data->link)}}">
<?php if(@$errors->first('link')) { ?> <span class="help-block">{{@$errors->first('link')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('image_link')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Image Link<em>*</em></label>
<div class="col-sm-6">
<input type="text" name="image_link" class="form-control" placeholder="Image Link" value="{{old('image_link',@$data->image_link)}}">
<?php if(@$errors->first('image_link')) { ?> <span class="help-block">{{@$errors->first('image_link')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('availability')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Availability<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('in stock'=>'In Stock'); ?>
<select name="availability" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<?php if(isset($data->availability) && !empty($data->availability)){ ?>
<option @if($key == $data->availability) {{'selected'}} @endif value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php }else{ ?>
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php } ?>
@endforeach
</select>
</div>
</div>
<div class="form-group @if($errors->first('product_condition')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Product Condition<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('NEW'=>'NEW'); ?>
<select name="product_condition" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<?php if(isset($data->product_condition) && !empty($data->product_condition)){ ?>
<option @if($key == $data->product_condition) {{'selected'}} @endif value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php }else{ ?>
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php } ?>
@endforeach
</select>
</div>
</div>
<div class="form-group @if($errors->first('item_group_id')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Item Group Id<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="item_group_id" class="form-control" placeholder="Item Group Id" value="{{old('item_group_id',@$data->item_group_id)}}">
<?php if(@$errors->first('item_group_id')) { ?> <span class="help-block">{{@$errors->first('item_group_id')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('google_product_category')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Google Product Category<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="google_product_category" class="form-control" placeholder="Google Product Category" value="{{old('google_product_category',@$data->google_product_category)}}">
<?php if(@$errors->first('google_product_category')) { ?> <span class="help-block">{{@$errors->first('google_product_category')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('product_type')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Product Type<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="product_type" class="form-control" placeholder="Product Type" value="{{old('product_type',@$data->product_type)}}">
<?php if(@$errors->first('product_type')) { ?> <span class="help-block">{{@$errors->first('product_type')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('sale_price')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Sale Price<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="sale_price" class="form-control" placeholder="Sale Price" value="{{old('sale_price',@$data->sale_price)}}">
<?php if(@$errors->first('sale_price')) { ?> <span class="help-block">{{@$errors->first('sale_price')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('price')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Price<em>*</em></label>
<div class="col-sm-4">
<input type="text" name="price" class="form-control" placeholder="Price" value="{{old('price',@$data->price)}}">
<?php if(@$errors->first('price')) { ?> <span class="help-block">{{@$errors->first('price')}}</span> <?php } ?>
</div>
</div>
<div class="form-group @if($errors->first('status')) {{' has-error has-feedback'}} @endif ">
<label for="inputError" class="col-sm-2 control-label">Status<em>*</em></label>
<div class="col-sm-4">
<?php $options = array('1'=>'Active','0'=>'InActive'); ?>
<select name="status" class="form-control">
<option value="">Select</option>
@foreach($options as $key => $option)
<?php if(isset($data->status) && !empty($data->status)){ ?>
<option @if($key == $data->status) {{'selected'}} @endif value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php }else{ ?>
<option value="<?php echo $key; ?>"><?php echo $option; ?></option>
<?php } ?>
@endforeach
</select>
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<input type="submit" value="Submit" class="btn btn-info">
<a href="{{route('admin.feeds')}}" class="btn btn-default">Cancel</a>
</div>
<!-- /.box-footer -->
</form>
</div>
</div>
<!--/.col (right) -->
</div>
</div>
</div>
<style>
.help-block{
color:red;
}
.error{
color:red;
}
</style>
<script type="text/javascript">
$( document ).ready(function() {
$.validator.addMethod('filesize', function(value, element, param) {
return this.optional(element) || (element.files[0].size <= param)
});
$.validator.addMethod("alphanumspecial", function (value, element) {
return this.optional(element) || /^(?=.*[a-z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{6,})/i.test(value);
}, "Combination of alphabets,special characters & numeric values required.");
$('#add-feedform').validate({
ignore: ".ignore",
rules: {
feeds_id: "required",
title: "required",
description: "required",
gtin: "required",
brand: "required",
color: "required",
size: "required",
link: "required",
image_link: "required",
availability: "required",
product_condition: "required",
item_group_id: "required",
google_product_category: "required",
product_type: "required",
sale_price: "required",
price: "required",
status: "required",
},
// Specify validation error messages
messages: {
feeds_id:"Please enter Feed ID.",
title:"Please enter Titale.",
description: "Please enter Description.",
gtin: "Please enter Gtin.",
brand: "Please enter Brand.",
color: "Please enter Color",
size: "Please enter Size.",
link: "Please enter Link.",
image_link: "Please enter Image Link.",
availability: "Please select availabilty.",
product_condition: "Please select Product Condition.",
item_group_id: "Please enter Item Group Id.",
google_product_category: "Please enter Google Product Category.",
product_type: "Please enter Product Type",
sale_price: "Please enter Sale Price.",
price: "Please enter Price.",
status: "Please select status."
},
});
});
</script>
<script src="{{ asset('/vendor/unisharp/laravel-ckeditor/ckeditor.js') }}"></script>
<script>
CKEDITOR.replace( 'description' );
</script>
@endsection
\ No newline at end of file
@extends('adminlte::page')
@section('content')
<div class="container-fluid">
<div class="">
<div class="col-sm-6">
<h2>Feed</h2>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Feed Tables</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Horizontal Form -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"></h3>
<div class="alert alert-success alert-dismissible groputitle" style="display:none">
</div>
@if(Session::has('add_message'))
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{!! session('add_message') !!}
</div>
@endif
<form id="feeds-mng" method="get" action="{{route('admin.feeds')}}">
{{ csrf_field() }}
<div class="row clearfix">
<div class="col-sm-2">
<div class="form-group">
<div class="form-line">
<input class="form-control" name="keyword" value="{{old('keyword',$request->keyword)}}" placeholder="Keyword" type="text">
</div>
</div>
</div>
<div class="col-sm-4">
<button type="submit" class="btn btn-primary btn-info">Search<div></div></button>
<a href="{{route('admin.feeds')}}" class="btn btn-primary btn-success">Reset</a>
</div>
<div class="col-sm-2 pull-right">
<a href="{{route('admin.feeds.add')}}" class="btn btn-block btn-warning">Add Feed</a>
</div>
</div>
</form>
@if(Session::has('message'))
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
{!! session('message') !!}
</div>
@endif
</div>
<!-- /.box-header -->
<form id="feeds-add" method="get" action="">
<div class="card">
<!-- /.card-header -->
<div class="card-body">
<table class="table table-bordered">
<tr>
<th style="width: 10px">#</th>
<th>@sortablelink('feeds_id')</th>
<th>@sortablelink('title')</th>
<th>@sortablelink('created_at')</th>
<th style="width: 40px">Action</th>
</tr>
@if(count($data['records'])>0)
<?php $k = ($pageNo == 1) ? $pageNo : (($pageNo - 1) * $record_per_page) + 1; ?>
@foreach($data['records'] as $row)
<tr>
<td>{{$row->id}}</td>
<td>{{$row->feeds_id}}</td>
<td>{{$row->title}}</td>
<td>{{date("F j, Y", strtotime($row->created_at))}}</td>
<td style="width:10%">
<a href="{{route('admin.feeds.edit',['id'=>$row->id])}}" class="btn btn-info btn-xs action-btn" title ="Edit"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a href="{{route('admin.feeds.delete',['id'=>$row->id])}}" class="btn btn-danger btn-xs action-btn" onclick="return confirm('Are you sure you want to delete ?');" title ="Delete"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
</td>
</tr>
<?php $k++; ?>
@endforeach
@else
<tr class="bg-info">
<td colspan="4">Record(s) not found.</td>
</tr>
@endif
</table>
</div>
<!-- /.card-body -->
<div class="card-footer clearfix">
<ul class="pagination pagination-sm m-0 float-right">
{!! $data['records']->links() !!}
</ul>
</div>
<!-- /.card -->
</div>
</form>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</div>
@endsection
......@@ -94,4 +94,12 @@ Route::group(['middleware' => ['auth'], 'prefix' => 'admin', 'namespace' => 'Adm
Route::get('cities/{id}/delete', 'CityController@deleteCity')->name('admin.cities.delete');
Route::post('getParentValue', 'CityController@getParentValue')->name('getParentValue');
/* For manage Locater Feeds */
Route::any('feeds', 'FeedController@feedsList')->name('admin.feeds');
Route::get('feeds/create', 'FeedController@createFeed')->name('admin.feeds.add');
Route::post('feeds/create', 'FeedController@saveFeed')->name('admin.feeds.save');
Route::get('feeds/{id}/edit', 'FeedController@editFeed')->name('admin.feeds.edit');
Route::post('feeds/{id}/edit', 'FeedController@updateFeed')->name('admin.feeds.update');
Route::get('feeds/{id}/delete', 'FeedController@deleteFeed')->name('admin.feeds.delete');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment