Esempio n. 1
0
 public function listcustomers()
 {
     $title = "List des clients";
     $customers = Customer::GetCustomerAsUser(Controller::User()->id)->get();
     return view('Customers/list-customers', ['title' => $title, 'customers' => $customers]);
 }
Esempio n. 2
0
@include ('inc.head')

  <body>
  @include ('inc.menu')
  @yield('banner')
  <div class="container">

    <div class="row">
      <div class="col-md-9 haut">
        @yield('content')
      </div>

      <div class="col-md-3">

        <?php 
$customers = \App\Customer::GetCustomerAsUser(Auth::user()->id)->get();
?>

        <h3>Clients : </h3>

        <ul class="client">
          @if(isset($customers))
              @foreach($customers as $customer)
                @if(!empty($customer->name))
                  <li><a href="{{route('afficheCustomer', $customer->id)}}" title="D&eacute;tail">{{ $customer->name }} {{$customer->last_name}}</a></li>
                @endif
              @endforeach
          @endif
        </ul>

 public function showCalendar($id)
 {
     $title = 'Calendrier';
     $customers = array();
     $custs = Customer::GetCustomerAsUser(Controller::User()->id)->get();
     foreach ($custs as $c) {
         $customers[$c->id] = $c->last_name . " " . $c->name;
     }
     $dateDispo = TestDriveDay::ListDateDispo($id)->get();
     $nondispo = array();
     if (!empty($dateDispo[0])) {
         $dateBegin = $dateDispo[0]->date_day;
         $dateEnd = $dateDispo[count($dateDispo) - 1]->date_day;
         $test = $dateBegin;
         $i = 0;
         foreach ($dateDispo as $d) {
             if ($test != $d->date_day) {
                 while ($test != $d->date_day) {
                     // echo $d->date_day."!=".$test."-----------";
                     array_push($nondispo, $test);
                     $test = strtotime("+1 day", strtotime($test));
                     $test = date("Y-m-d", $test);
                 }
                 $test = strtotime("+1 day", strtotime($test));
                 $test = date("Y-m-d", $test);
             } else {
                 $test = strtotime("+1 day", strtotime($test));
                 $test = date("Y-m-d", $test);
             }
         }
         $nondispo = str_replace("-", "/", json_encode($nondispo));
         return view('TestDrives/calendar-Test-Drive', ['title' => $title, 'dateDispo' => $dateDispo, 'dateEnd' => $dateEnd, 'dateBegin' => $dateBegin, 'carid' => $id, 'nondispo' => $nondispo, 'customers' => $customers]);
     } else {
         return view('TestDrives/calendar-Test-Drive', ['title' => $title, 'carid' => $id, 'dateBegin' => "", 'dateEnd' => "", 'nondispo' => "[]", 'customers' => $customers]);
     }
 }