예제 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $facture = Facture::findOrFail($id);
     /*Lists*/
     $projects = Project::lists('name', 'id');
     $selectedProjects = $facture->projects->lists('id')->flatten()->all();
     $contacts = Contact::select('id', DB::raw('CONCAT(first_name, " ", last_name) as full_name'))->orderBy('last_name', 'asc')->lists('full_name', 'id');
     $clients = Client::lists('email', 'id');
     //dd($selectedProjects);
     return view('admin.facture.edit', compact('facture', 'projects', 'selectedProjects', 'contacts', 'clients'));
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function editer($id)
 {
     //
     $actif = 'gescom';
     $societes[''] = '';
     $societes[0] = 'Tous les contacts';
     $contacts[''] = '';
     $gescom = Gescom::first();
     $societe = Societe::select('id', 'nom_clt')->where('etat', 1)->get();
     $contact = Contact::select('id', 'nom_contact', 'prenoms_contact')->where('etat', 1)->get();
     $modules[''] = '';
     $module = Module::where('etat_module', 1)->orderBy('nom_module', 'asc')->get();
     // Remplissage du tableau des modules
     foreach ($module as $key => $value) {
         foreach ($value->produits as $pkey => $pvalue) {
             $modules[$value->id . '.' . $pvalue->id] = $value->nom_module . ' (' . $pvalue->nom_produit . ')';
         }
     }
     // Remplissage du tableau des sociétés
     foreach ($societe as $key => $value) {
         $societes[$value->id] = $value->nom_clt;
     }
     // Remplissage du tableau des contacts
     foreach ($contact as $key => $value) {
         $contacts[$value->id] = $value->nom_contact . ' ' . $value->prenoms_contact;
     }
     $profil = Devis::with('gescom', 'societedata')->findOrfail($id);
     foreach ($profil->modules as $key => $value) {
         $produit_id = $value->pivot->produit_id;
     }
     $produit = Produit::findOrFail($produit_id);
     $produits = $produit->modules;
     $actif = 'gescom';
     return view('gescom.edit-devis', compact('actif', 'profil', 'produits', 'contacts', 'gescom', 'societes', 'modules'));
 }
예제 #3
0
        $id = strbefore(Request::get('id'), '.');
        $id_produit = strafter(Request::get('id'), '.');
        $module = Module::select('prix_module')->findOrFail($id);
        $produit = Produit::select('nom_produit', 'vers_produit')->findOrFail($id_produit);
        $data['module']['prix_module'] = $module->prix_module;
        $data['produit']['id'] = $id_produit;
        $data['produit']['nom'] = 'Licence ' . $produit->nom_produit . ' Version ' . $produit->vers_produit;
    }
    return json_encode($data);
});
/**** Ajax for others pages ***/
Route::get('/SocieteSelect', function () {
    if (Request::ajax()) {
        $id = Request::get('id');
        if ($id == 0) {
            $contacts = Contact::select('id', 'nom_contact', 'prenoms_contact')->where('etat', 1)->get();
        } else {
            $contacts = Societe::findOrFail($id)->contacts()->where('etat', 1)->get();
        }
        if ($contacts->isEmpty()) {
            $data = [];
        } else {
            foreach ($contacts as $key => $value) {
                $data[$value->id] = $value->nom_contact . ' ' . $value->prenoms_contact;
            }
        }
    }
    return json_encode($data);
});
Route::get('/ContactSelect', function () {
    if (Request::ajax()) {
예제 #4
0
 /**
  * 根据关键字查找
  *
  * @return mixed
  */
 public function index()
 {
     $condition = '%' . Input::get("keywords") . '%';
     return response()->json(['contacts' => Contact::select('id', 'name', 'phone', 'address')->where('name', 'like', $condition)->orWhere('address', 'like', $condition)->orderBy('use_count', 'desc')->take(10)->get()]);
 }
예제 #5
0
 public function modifierNote($id, $back)
 {
     $actif = 'notes';
     $contacts[''] = '';
     $user = User::select('id', 'name', 'prenom')->where('etat', 1)->get();
     $contact = Contact::select('id', 'nom_contact', 'prenoms_contact')->where('etat', 1)->get();
     // Remplissage du tableau des contacts
     foreach ($contact as $key => $value) {
         $contacts[$value->id] = $value->nom_contact . ' ' . $value->prenoms_contact;
     }
     // Remplissage du tableau des utilisateurs
     foreach ($user as $key => $value) {
         $users[$value->id] = $value->name . ' ' . $value->prenom;
     }
     $users[Auth::user()->id] = 'Moi';
     $note = Note::FindOrFail($id);
     return view('notes.edit', compact('note', 'actif', 'back', 'contacts', 'users'));
 }
 public function globContacts(Request $request)
 {
     $start = \Carbon\Carbon::now('Africa/Johannesburg');
     echo 'Start : ' . $start . '<br>';
     // get all farmbook databases
     $farmbooks = Farmbook::orderBy('name')->get();
     $email = Auth::user()->email;
     //log
     $action = 'GLOBAL UPDATE';
     $comment = 'Contacts';
     $append = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString() . ',          ' . trim($email) . ',          ' . $action . ',' . $comment;
     Storage::append('logfile.txt', $append);
     // loop through databases
     for ($x = 0; $x < $farmbooks->count(); $x++) {
         $error = 0;
         $database = $farmbooks[$x]->database;
         try {
             //change database
             $own = new Owner();
             $own->changeConnection($database);
             // fetch records with missing info for te numbers and email
             $owners = Owner::on($database)->select('*')->where('strHomePhoneNo', '')->orWhere('strWorkPhoneNo', '')->orWhere('strCellPhoneNo', '')->orWhere('EMAIL', '')->get();
             $noinfoowners = Owner::on($database)->select('*')->where('strHomePhoneNo', '')->Where('strWorkPhoneNo', '')->Where('strCellPhoneNo', '')->Where('EMAIL', '')->get();
             $allowners = Owner::on($database)->select('*')->get();
             //dd($owners);
         } catch (Exception $ex) {
             //   echo "<br> ------------------------------------------------------------------" . "<br>";
             //   echo $x . ". " . $farmbooks[$x]->database . " <br>";
             //   echo " **  PROBLEM **  " . $ex->getMessage() . "<br>";
             //   echo " ------------------------------------------------------------------" . "<br>";
             $error = 1;
             //dd();
         }
         //dd($prop);
         if ($error == 0) {
             // check it has the farmbook2 ext
             $found = strpos($database, 'farmbook2');
             //   echo "<br> ------------------------------------------------------------------" . "<br>";
             //  if ($found == 0) {
             //      echo "** ALERT **  Database has not got correct naming convention - farmbook2" . " <br>";
             //  }
             echo "<br> ------------------------------------------------------------------" . "<br>";
             echo $x . ". Farmbook : " . $database . "<br><br>";
             echo 'Local Owners : ' . $allowners->count() . "<br>";
             echo 'Missing some info : ' . $owners->count() . "<br>";
             echo 'Missing all info : ' . $noinfoowners->count() . "<br>";
             if ($owners->count() > 0) {
                 //  echo " ------------------------------------------------------------------" . "<br>";
                 // $users = $farmbooks[$x]->users;
                 $new = 0;
                 $canupdate = 0;
                 $can = 0;
                 $canupdateRow = 0;
                 $strHomePhoneNo = 0;
                 $strWorkPhoneNo = 0;
                 $strCellPhoneNo = 0;
                 $EMAIL = 0;
                 foreach ($owners as $owner) {
                     //[0] echo " - " . $owner->NAME . " | " . $owner->strHomePhoneNo . " | " . $owner->strWorkPhoneNo . " | " . $owner->strCellPhoneNo . " | " . $owner->EMAIL . " | " . " <br>";
                     $found = Contact::select('*')->where('strIDNumber', $owner->strIDNumber)->get();
                     if ($found->count() > 0) {
                         $new++;
                         $can = 0;
                         if ($owner->strHomePhoneNo == "" && $found[0]->strHomePhoneNo != "") {
                             $canupdate++;
                             $can++;
                             $strHomePhoneNo++;
                             $owner->strHomePhoneNo = $found[0]->strHomePhoneNo;
                         }
                         if ($owner->strWorkPhoneNo == "" && $found[0]->strWorkPhoneNo != "") {
                             $canupdate++;
                             $can++;
                             $strWorkPhoneNo++;
                             $owner->strWorkPhoneNo = $found[0]->strWorkPhoneNo;
                         }
                         if ($owner->strCellPhoneNo == "" && $found[0]->strCellPhoneNo != "") {
                             $canupdate++;
                             $can++;
                             $strCellPhoneNo++;
                             $owner->strCellPhoneNo = $found[0]->strCellPhoneNo;
                         }
                         if ($owner->EMAIL == "" && $found[0]->EMAIL != "") {
                             $canupdate++;
                             $can++;
                             $EMAIL++;
                             $owner->EMAIL = $found[0]->EMAIL;
                         }
                         if ($can > 0) {
                             $canupdateRow++;
                             $owner->update();
                         }
                     }
                 }
                 echo '  Found in admin contacts : ' . $new . '<br><br>';
                 echo '  Can update fields : ' . $canupdate . '<br>';
                 echo '  Can update record : ' . $canupdateRow . '<br><br>';
                 echo 'strHomePhoneNo updates : ' . $strHomePhoneNo . '<br>';
                 echo 'strWorkPhoneNo updates : ' . $strWorkPhoneNo . '<br>';
                 echo 'strCellPhoneNo updates : ' . $strCellPhoneNo . '<br>';
                 echo 'EMAIL          updates : ' . $EMAIL . '<br><br>';
                 //dd("end of first data");
             }
         }
     }
     $end = \Carbon\Carbon::now('Africa/Johannesburg');
     echo '<br><br>End : ' . $end . '<br><br>';
     echo 'Time : ' . $end->diffForHumans($start);
     dd("The End");
 }