public function select_printer() { try { Log::info('======> Test Printer <======'); $type_printer = Input::get('type_printer'); //$printers = PrinterParents::where('parentId',$type_printer)->printer_alias()->printers()->get(); if ($type_printer == 'all') { $printers = ''; } else { $printer_parents = PrinterParents::where('parentId', $type_printer)->first(); $printers = $printer_parents->printer_alias()->get(); } //return Response::json(['status' => 'success', 'msg' => 'test']); return View::make('qlmadministrator.printers')->with(array('printers' => $printers, 'selected' => $type_printer)); } catch (Exception $_ex) { Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$'); Log::error('$printers:' . $_ex->getMessage()); return View::make('qlmadministrator.printers')->with(array('printers' => $printers, 'selected' => $type_printer)); } }
@if (Session::has('error')) <div class="alert alert-error">{{ Session::get('error') }}</div> @endif <div class="table-responsive"> <form action="{{asset('qlm-admin/page-new-printer')}}" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>Product Name</label> <input class="form-control" name="detailName" placeholder="Enter text"> </div> <div class="form-group"> <label>Type(Best Price,We Recommend,etc...)</label> <input class="form-control" name = "detailType" placeholder="Enter text"> </div> <div class="form-group"> <?php $brands = PrinterParents::all(); ?> <label>Product Brand/Product Classify</label> <select class="form-control selectpicker" multiple name="type_printer[]" id="type_printer"> @foreach($brands as $brand) <option value="{{$brand->parentId}}">{{$brand->parentName}}</option> @endforeach </select> </div> <div class="form-group"> <label>Main Image(WxH: 452x300 )</label> <input id="input-banner-id" type="file" name="filedetailBImage" multiple="false" class="file" data-preview-file-type="text" data-allowed-file-extensions='["jpg", "png"]'> </div> <div class="form-group"> <label>Item Images(WxH: 452x300 - 3 items) </label> <input id="input-id" type="file" name="filedetailTImage[]" multiple="true" class="file" data-preview-file-type="text" data-allowed-file-extensions='["jpg", "png"]'>
<span class="pull-left"><i class="fa fa-plus"></i> Add New Product</span> <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span> <div class="clearfix"></div> </div> </a> </div> </div> </div> <!-- /.row --> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <h2>List of Products</h2> <div class="form-group"> <label>Product Brand</label> <?php $types = PrinterParents::where('parentType', '1')->get(); ?> <form action="{{asset('qlm-admin/select-printer')}}" method="POST"> <div class="row"> <div class="col-md-8"> <select class="form-control" name="type_printer" id="type_printer"> <option value="all" @if(isset($selected) && $selected=='all') {{'selected'}} @endif>All</option> @foreach($types as $type) <option value="{{$type->parentId}}" @if(isset($selected) && $selected==$type->parentId) {{'selected'}} @endif>{{$type->parentName}}</option> @endforeach </select> </div> <div class="col-md-4"> <button type="submit" class="btn btn-default btn-primary">Search</button> </div> </div>