示例#1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data = Items::find($id);
     if ($data) {
         if ($request->has('name')) {
             $data->name = $request->input('name');
         }
         if ($request->has('status') && ($status = States::find($request->input('status')))) {
             $data->status = $status->id;
         }
         if ($request->has('user_id') && ($person = Persons::find($request->input('user_id')))) {
             $data->user_id = $person->id;
         }
         if ($request->has('title')) {
             $data->title = $request->input('title');
         }
         if ($request->has('description')) {
             $data->description = $request->input('description');
         }
         if ($data->save()) {
             return $this->success($data);
         } else {
             return $this->error("failed to save");
         }
     } else {
         return $this->error("No person with this id");
     }
 }
示例#2
0
 public function store(FormBuilder $formBuilder, Request $request)
 {
     $form = $formBuilder->create(StatesForm::class);
     // It will automatically use current request, get the rules, and do the validation
     if (!$form->isValid()) {
         return redirect()->back()->withErrors($form->getErrors())->withInput();
     }
     States::create($request->all());
     return redirect()->route('state.index');
 }
示例#3
0
 public function action_get_states($country = false)
 {
     if (!\Input::is_ajax()) {
         return;
     }
     $out = '<option value="">-</option>';
     $states = \App\States::forge();
     if ($states_array = $states->getStateProvinceArray($country)) {
         $out = '';
         foreach ($states_array as $key => $value) {
             $out .= '<option value="' . $key . '">' . $value . '</option>';
         }
     }
     echo $out;
     exit;
 }
示例#4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (States::isProtected($id)) {
         return $this->error("This item is protected");
     }
     if (sizeof(States::all()) <= 2) {
         return $this->error("Do you really want to delete all States? In which state are you?!");
     }
     if (Items::hasStatus($id) || Persons::hasStatus($id)) {
         return $this->error("Do you really want to delete all States? In which state are you?!");
     }
     $data = States::find($id);
     if ($data) {
         $data->delete();
         return $this->success($data);
     } else {
         return $this->error("Item doesn't exist");
     }
 }
 public function getEditStore($id)
 {
     $store = MerchantStore::with(['Address', 'tags', 'Merchant'])->where('id', $id)->first();
     $tags = Tag::all();
     $cities = Cities::all();
     $areas = Areas::all();
     $states = States::all();
     $countries = Countries::all();
     $output = ['store' => $store, 'tags' => $tags, 'areas' => $areas, 'cities' => $cities, 'states' => $states, 'countries' => $countries];
     return view('admin.storeEdit', $output);
 }
示例#6
0
 public function buildForm()
 {
     $this->add('state_id', 'select', ['choices' => States::getList(), 'empty_value' => '=== Select state ==='])->add('good_id', 'select', ['choices' => Goods::getList(), 'empty_value' => '=== Select good ==='])->add('client_phone', 'text', ['rules' => 'required'])->add('client_name', 'text', ['rules' => 'required'])->add('save', 'submit', ['label' => 'Save order']);
 }
示例#7
0
echo \Theme::instance()->view('views/user/_tree_links');
?>
				                    </div><!-- EOF Sidebar Holder -->
				                    
				                    <div class="clear"></div>
				                    
								<?php 
echo \Form::close();
?>
			                    
						    </div>
			    		</div>
			    	</div>
			    </div>
			    <!-- EOF Content -->
                
                <!-- This two arrays are requred for script below to work -->
                <script type="text/javascript">
                    var countries = <?php 
echo json_encode(\App\Countries::forge()->getCountries());
?>
;
                    var states = <?php 
echo json_encode(\App\States::forge()->getAll());
?>
;
                </script>
                <?php 
\Theme::instance()->asset->js('country_state_functions.js', array(), 'basic');
?>
                            
        echo $margin();
        ?>
">
                                        <?php 
        echo \Form::label('Shipping Status');
        ?>
                                        <?php 
        echo \Form::select('shipping_status', \Input::get('shipping_status'), array('false' => 'Select') + \Config::get('details.shipping_status', array()), array('class' => 'select_init filter_width'));
        ?>
                                    </div>
                                <?php 
    }
    ?>
                                
                                <?php 
    $states = \App\States::forge()->getStateProvinceArray(\Input::get('country'));
    if (!is_array($states)) {
        $states = array();
    }
    ?>
                                <?php 
    if (in_array('state', $options)) {
        ?>
                                    <div class="filter_width <?php 
        echo $margin();
        ?>
">
                                        <?php 
        echo \Form::label('State');
        ?>
                                        <?php 
示例#9
0
 public function allElementsV2()
 {
     $output = ['tags' => Tag::get(), 'cities' => Cities::with('Areas')->get(), 'states' => States::get(), 'countries' => Countries::get(), 'appElements' => AppElement::find(1)];
     return response()->json(['response_code' => 'RES_STS', 'messages' => 'States', 'data' => $output]);
 }
示例#10
0
 public function getStates()
 {
     return response()->json(['response_code' => 'RES_STS', 'messages' => 'States', 'data' => States::get()]);
 }
示例#11
0
                        <?php 
echo \Form::label('State:');
?>
                        <div class="input_holder">

                            <?php 
if (!\App\States::forge()->getStateProvinceArray(\Input::post('shipping_country', 'AU'))) {
    ?>
                                <?php 
    echo \Form::input('shipping_state', \Input::post('shipping_state', isset($user) ? $user->get('metadata.shipping_state') : ''), array('class' => 'state_select state_input'));
    ?>
                            <?php 
} else {
    ?>
                                <?php 
    echo \Form::select('shipping_state', \Input::post('shipping_state', isset($user) ? $user->get('metadata.shipping_state') : ''), \App\States::forge()->getStateProvinceArray(\Input::post('shipping_country', 'AU')), array('class' => 'select_init small_select state_select'));
    ?>
                            <?php 
}
?>
                        </div>
                    </div>
                    <div class="small_res_postcode">
                        <?php 
echo \Form::label('Postcode:', null, array('class' => 'postcode_small_label'));
?>
                        <div class="input_holder"><?php 
echo \Form::input('shipping_postcode', \Input::post('shipping_postcode', isset($user) ? $user->get('metadata.shipping_postcode') : ''), array('class' => 'postcode_small'));
?>
</div>
                    </div>
示例#12
0
                                <?php 
// Configs
$invoice = array('' => '-') + \Config::get('details.invoice', array());
$status = array('' => '-') + \Config::get('details.status', array());
$delivery = array('' => '-') + \Config::get('details.delivery', array());
$app_countries = \App\Countries::forge();
$countries = $app_countries->getCountries();
$app_states = \App\States::forge();
?>
                <?php 
echo \Theme::instance()->view('views/_partials/blue_header', array('title' => 'Manage Orders'));
?>
                
                <?php 
echo \Theme::instance()->view('views/order/_navbar_links');
?>
	            
	            <!-- Content -->
			    <div class="content_wrapper">
			    	<div class="content_holder">
			    		
			    		<div class="elements_holder">
			    		
                            <div class="row-fluid breadcrumbs_holder">
			    				<div class="breadcrumbs_position">
                                    <?php 
\Breadcrumb::set('Home', 'admin/dashboard');
\Breadcrumb::set('Orders');
\Breadcrumb::set('Manage Orders', 'admin/order/list');
\Breadcrumb::set('ID: ' . $order->id);
echo \Breadcrumb::create_links();