Ejemplo n.º 1
0
 public function create($id, $tech_number = 1)
 {
     if (Auth::user()->can('create-service')) {
         $data['title'] = $tech_number == 1 ? "Create Service ~ " . $tech_number . " technician" : "Create Service ~ " . $tech_number . " technicians";
         $data['companies'] = Company::all();
         $data['company_id'] = $id;
         $data['contacts'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . $id], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['technicians'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['divisions'] = Division::orderBy("name")->get();
         $data['hotels'] = Hotel::where('company_id', $id)->orderBy("name")->get();
         $tech_number = $tech_number < 1 ? 1 : $tech_number;
         $tech_number = $tech_number > 5 ? 5 : $tech_number;
         $data['technician_number'] = $tech_number;
         foreach ($data['hotels'] as &$hotel) {
             $hotel['name_address'] = $hotel['name'] . " @ " . $hotel['address'];
         }
         return view('services/create', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to service create page']);
     }
 }
Ejemplo n.º 2
0
		<a href="{{ route('root') }}"><img src="/resources/style/logo-elettric80.png"></a>
	</div>

	<!-- Login Ribbon -->
	@if (Auth::check())
		<div id="login_ribbon">
			<div id="thumb">				
				<img src="{!! Auth::user()->active_contact->person->profile_picture()->path() !!}">
			</div>
			<div id="info">			
				<div> <a href="{{ route('company_person.show', Auth::user()->active_contact->id) }}"> {{ Auth::user()->active_contact->person->name() }} </a> </div>
				<div> 
					@if (Session::get('debug') == true)
						
						<?php 
$contacts = CompanyPersonController::API()->all(["order" => ["people.last_name", "people.first_name"], "paginate" => "false", "debugger_list" => "true"]);
?>

						{!! Form::open(array('route' => array('users.switch_contact'),'id' => 'switch_company_person_form')) !!}
						{!! Form::BSSelect("switch_company_person_id", $contacts, Auth::user()->active_contact->id, ["key" => "id", "value" => ["!person.last_name"," ","!person.first_name"," @ ","!company.name"], "id" => "switch_company_person_id"]) !!}
						{!! Form::close() !!}
					@else
						{!! Form::open(array('route' => array('users.switch_contact'),'id' => 'switch_company_person_form')) !!}
						{!! Form::BSSelect("switch_company_person_id", Auth::user()->owner->company_person, Auth::user()->active_contact->id, ["key" => "id", "value" => "!company.name", "id" => "switch_company_person_id"]) !!}
						{!! Form::close() !!}
					@endif
				</div>
				<div> <a href="/logout"> Logout </a> </div>
			</div>
		</div>
	@endif
 public function contacts($id)
 {
     $params = array_merge(Request::input(), ['where' => ['companies.id|=|' . $id], 'paginate' => 10]);
     $data['contacts'] = CompanyPersonController::API()->all($params);
     return view('company_person/contacts', $data);
 }
Ejemplo n.º 4
0
 public function edit($id)
 {
     if (Auth::user()->can('update-ticket')) {
         $data['ticket'] = self::API()->find(['id' => $id]);
         $temp = DB::table("ticket_links")->where("ticket_id", "=", $id)->get();
         foreach ($temp as $elem) {
             $links[] = $elem->linked_ticket_id;
         }
         $data['ticket']['linked_tickets_id'] = isset($links) ? implode(",", $links) : '';
         $data['companies'] = Company::where('id', '!=', ELETTRIC80_COMPANY_ID)->orderBy('name')->get();
         $data['priorities'] = Priority::orderBy('id', 'desc')->get();
         $data['divisions'] = Division::orderBy('name')->get();
         $data['job_types'] = JobType::orderBy('name')->get();
         $data['levels'] = Level::orderBy('name')->get();
         $data['assignees'] = CompanyPersonController::API()->all(["where" => ["companies.id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['companies'] = CompaniesController::API()->all(['where' => ['companies.id|!=|' . ELETTRIC80_COMPANY_ID], 'order' => ['companies.name|ASC'], 'paginate' => 'false']);
         $data['tags'] = "";
         foreach ($data['ticket']->tags as $tag) {
             $data['tags'] .= $tag->name . ",";
         }
         $is_draft = $data['ticket']->status_id == TICKET_DRAFT_STATUS_ID ? true : false;
         $data['title'] = "Edit Ticket #" . $id;
         return view('tickets/edit', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to tickets edit page']);
     }
 }