Esempio n. 1
0
 public static function New_Assign($assign_id)
 {
     $root_url = dirname($_SERVER['PHP_SELF']);
     $root_url = "http://ojconsultinggroup.com" . $root_url;
     $assingment = Assignment::where("id", "=", $assign_id)->first();
     $user = Member::where("id", "=", $assingment->user_id)->first();
     $event = event::where("id", "=", $assingment->event_id)->first();
     $customer_id = $event->customer_id;
     $venue_id = $event->venue_id;
     $venue_room = venue::where("id", "=", $venue_id)->first();
     $customer = customer::where("id", "=", $customer_id)->first();
     $userid = $user->id;
     $idcard = $user->id_card;
     $name = $user->name . " " . $user->surname;
     $email = $user->email;
     $event_name = $event->event_name;
     $event_type = $event->event_type;
     $split_event_date = explode("-", $event->event_date);
     $event_date = $split_event_date[2] . " " . AssignCalendar::get_month_thai($split_event_date[1]) . " " . AssignCalendar::get_BE_year($split_event_date[0]);
     $staff_appointment_time = $event->staff_appointment_time;
     $customer_name = $customer->symbol . " - " . $customer->name;
     $venue_name = $venue_room->venue->name . " : " . $venue_room->room_name;
     $venue_address = $venue_room->venue->address;
     $subject = "OJ - คุณได้รับมอบหมายงานในวันที่ " . $event_date;
     $data = array('root_url' => $root_url, 'userid' => $userid, 'idcard' => $idcard, 'id' => $assign_id, 'name' => $name, 'event_name' => $event_name, 'event_type' => $event_type, 'event_date' => $event_date, 'staff_appointment_time' => $staff_appointment_time, 'customer_name' => $customer_name, 'venue_name' => $venue_name, 'venue_address' => $venue_address, 'subject' => $subject, 'email' => $email);
     Mail::queue('Assign.New_assign_mail', $data, function ($message) use($data) {
         $message->to($data['email'])->subject($data['subject']);
     });
 }
Esempio n. 2
0
 public static function main()
 {
     $Customer = customer::orderBy('symbol')->get();
     $customer_list = array();
     foreach ($Customer as $query) {
         $full_name = $query->symbol . " - " . $query->name;
         $customer_id = $query->id;
         $customer_list[] = "[" . $customer_id . "] " . $full_name;
     }
     echo json_encode($customer_list);
 }
Esempio n. 3
0
 public static function getcustomer($id, $type)
 {
     if ($type == 'edit') {
         $event = event::where("id", "=", $id)->first();
         $id = $event->customer_id;
     }
     $customer = customer::orderBy('symbol')->get();
     echo "<select name='customer_id' id='customer_id' class='form-control'><option value='0'>none</option>";
     foreach ($customer as $recode) {
         echo "<option value='" . $recode->id . "'";
         if ($id == $recode->id) {
             echo " selected='selected'";
         }
         echo ">" . $recode->symbol . " - " . $recode->name . "</option>";
     }
     echo "</select>";
 }
Esempio n. 4
0
 public function edit()
 {
     //check input form
     $validate = validatecustomer::validateeditcustomer(Request::all());
     if ($validate->passes()) {
         $customer = customer::where("id", "=", Request::input('id'))->first();
         $customer->name = Request::input('name');
         $customer->symbol = Request::input('symbol');
         $customer->address = Request::input('address');
         $customer->phone = Request::input('phone');
         $customer->website = Request::input('website');
         $customer->tax_address = Request::input('tax_address');
         $customer->tax_id = Request::input('tax_id');
         if ($customer->save()) {
             return redirect::to('customer_detail/' . Request::input('id'))->with('status', "แก้ไขข้อมูลลูกค้าชื่อ " . Request::input('name') . " สำเร็จ");
         } else {
             return redirect::to('edit_customer/' . Request::input('id'))->withInput(Request::except('password'))->withErrors("เกิดข้อผิดพลาด - ไม่สามารถแก้ไขข้อมูลลูกค้าได้");
         }
     } else {
         return redirect::to('edit_customer/' . Request::input('id'))->withInput(Request::all())->withErrors($validate->messages());
     }
 }
Esempio n. 5
0
 public static function getall($filter_group, $filter_value, $sort)
 {
     if ($filter_group == 1) {
         $input_date = explode("/", $filter_value);
         $date = $input_date[2] . "-" . $input_date[1] . "-" . $input_date[0];
         $event = event::where('event_date', '=', $date)->orderBy('event_date')->get();
     } else {
         if ($filter_group == 2 && $filter_value != "all") {
             $event = event::where('event_status', '=', $filter_value)->orderBy('event_date')->get();
         } else {
             if ($filter_group == 2 && $filter_value == "all") {
                 $event = event::orderBy('event_status')->get();
             } else {
                 $now = date("Y-m-d");
                 $event = event::where('event_date', '>=', $now)->orderBy('event_date')->get();
             }
         }
     }
     $returnhtml = "<table class='table table-bordered table-hover table-striped'>\n                        <thead>\n                        <tr>\n                        <th class='text-center'>ยื่นขอทำงานนี้</th>\n                        <th class='text-center'>จัดการคน</th>\n                        <th class='text-center'>วันที่</th>\n                        <th class='text-center'>ช่วงเวลางาน</th>\n                        <th class='text-center'>ชื่องาน</th>\n                        <th class='text-center'>ชื่อลูกค้า</th>\n                        <th class='text-center'>สถานที่จัดประชุม</th>\n                        <th class='text-center'>สถานะของงาน</th>\n                        </tr>\n                        </thead>\n                        <tbody>";
     foreach ($event as $record) {
         $customerid = $record->customer_id;
         $customer = customer::where('id', '=', $customerid)->first();
         $customername = $customer->symbol . " - " . $customer->name;
         $event_status = Getdataform::event_status($record->event_status, 'getvalue');
         //get venue
         //$venueid = $record->venue_id;
         $venuename = venue_room_control::venue_detail($record->id, "link");
         //end get venue id
         $split_event_date = explode("-", $record->event_date);
         $event_date = $split_event_date[2] . "/" . $split_event_date[1] . "/" . $split_event_date[0];
         if ($record->meeting_period == 2) {
             $meeting_period = "ช่วงเช้า";
         } else {
             if ($record->meeting_period == 3) {
                 $meeting_period = "ช่วงบ่าย";
             } else {
                 $meeting_period = "ทั้งวัน";
             }
         }
         if (LoginController::checkverifyuser()) {
             $request_botton = "<form style='display:inline;' role='form' method='POST' action='request_event' >\n                                <input type='hidden' name='_token' value='" . csrf_token() . "'>\n                                <input type='hidden' name='event_id' value='" . $record->id . "'>\n                                <a class='btn btn-success btn-circle request_this_event' id='" . $record->id . "'>\n                                  <i class='fa fa-sign-in fa-lg request_this_event' style='cursor:pointer;' id='" . $record->id . "'></i>\n                                </a>\n                                <button type='submit' class='btn btn-success btn-circle hidden' id='submit_" . $record->id . "'>\n                                  <i class='fa fa-sign-in fa-lg request_this_event' style='cursor:pointer;'></i>\n                                </button>\n                              </form>";
         } else {
             $request_botton = "";
         }
         if (LoginController::checkpermission(2)) {
             $assign_botton = "<a href='assigment/" . $record->id . "' class='btn btn-outline btn-info btn-circle' target='_blank'>\n            <i class='fa fa-user fa-lg' style='cursor:pointer;'></i>\n            </a>";
         } else {
             $assign_botton = "";
         }
         $returnhtml .= "<tr><td class='text-center'>" . $request_botton . "</td><td class='text-center'>" . $assign_botton . "</td></td><td class='text-center'>" . $event_date . "</td></td><td class='text-center'>" . $meeting_period . "</td><td class='text-center'><a href='event_detail/" . $record->id . "'>" . $record->event_name . "</a><td class='text-center'><a href='customer_detail/" . $customerid . "'>" . $customername . "</a><td class='text-center'>" . $venuename . "</td><td class='text-center'>" . $event_status . "</td><tr>";
     }
     $returnhtml .= "</tbody>\n                        </table>";
     echo $returnhtml;
 }