示例#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']);
     });
 }
示例#2
0
 public static function get_room($event_id)
 {
     $event = event::where("id", "=", $event_id)->first();
     $room_id = $event->venue_id;
     $venue_room = venue_room::where('id', '=', $room_id)->first();
     $venue_name = $venue_room->venue->name;
     $room_name = $venue_room->room_name;
     $full_name = $venue_name . " - " . $room_name;
     $room_id = $venue_room->id;
     $rooom_list = "[" . $room_id . "] " . $full_name;
     return $rooom_list;
 }
示例#3
0
 public static function get_event_date($event_id)
 {
     $event = event::where('id', '=', $event_id)->first();
     return $event->event_date;
 }
示例#4
0
文件: Assign.php 项目: geniuspom/4oj
 public static function main($method, $value)
 {
     if ($method == "Get_request_event") {
         $Udata = AS_Requestjob::get_request_event($value);
         $return_html = Assign::generate_html($Udata, "");
         echo $return_html;
     } else {
         if ($method == "Get_request_date") {
             $Udata = AS_Requestjob::get_request_day($value);
             $return_html = Assign::generate_html($Udata, "");
             echo $return_html;
         } else {
             if ($method == "Get_all_user") {
                 $Udata = AS_Requestjob::get_all_user($value);
                 $return_html = Assign::generate_html($Udata, "");
                 echo $return_html;
             } else {
                 if ($method == "Get_assign_user") {
                     $Udata = AS_Requestjob::Get_assign_user($value);
                     $return_html = Assign::generate_html($Udata, "assignment_user");
                     echo $return_html;
                 } else {
                     if ($method == "remove_from_assign") {
                         $remove_type = $value["type"];
                         $event_id = $value["event_id"];
                         $user_id = $value["user_id"];
                         $not_include = $value["not_include"];
                         $include = $value["include"];
                         if ($remove_type == "assignment_user") {
                             if (!empty($user_id)) {
                                 $Moveto = AS_Requestjob::find_user_request_type($event_id, $user_id);
                                 if ($Moveto == "request_event_user") {
                                     $Udata = AS_Requestjob::get_request_event($event_id);
                                 } else {
                                     if ($Moveto == "request_job_user") {
                                         $Udata = AS_Requestjob::get_request_day($event_id);
                                     } else {
                                         $Udata = AS_Requestjob::get_all_user($event_id);
                                     }
                                 }
                                 $event = event::where("id", "=", $event_id)->first();
                                 $event_date = $event->event_date;
                                 $usernameall = AS_Member::get_user_data($user_id, 'fullname');
                                 $usergrade = AS_Member::get_user_detail($user_id, 'grade');
                                 $sortgrade = AS_Member::get_user_detail($user_id, 'sortgrade');
                                 $userstatus = Check_busy::main($user_id, $event_date);
                                 $assign_id = "";
                                 $category = "assignment_user";
                                 $Udata[] = ["user_id" => $user_id, "usernameall" => $usernameall, "usergrade" => $usergrade, "sortgrade" => $sortgrade, "userstatus" => $userstatus, "assign_id" => $assign_id, "category" => $category];
                             }
                         } else {
                             if ($remove_type == "request_event_user") {
                                 $Udata = AS_Requestjob::get_request_event($event_id);
                                 $Moveto = "request_event_user";
                             } else {
                                 if ($remove_type == "request_job_user") {
                                     $Udata = AS_Requestjob::get_request_day($event_id);
                                     $Moveto = "request_job_user";
                                 } else {
                                     $Udata = AS_Requestjob::get_all_user($event_id);
                                     $Moveto = "all_user";
                                 }
                             }
                         }
                         if (!empty($not_include)) {
                             for ($i = 0; $i < count($not_include); $i++) {
                                 foreach ($Udata as $key => $value) {
                                     if ($value["user_id"] == $not_include[$i]) {
                                         unset($Udata[$key]);
                                     }
                                 }
                             }
                         }
                         usort($Udata, function ($a, $b) {
                             return $b["sortgrade"] - $a["sortgrade"];
                         });
                         $return_html = Assign::generate_html($Udata, "");
                         $arr = array("code_return" => $return_html, "moveto" => $Moveto);
                         echo json_encode($arr);
                     }
                 }
             }
         }
     }
 }
示例#5
0
 public static function request_event()
 {
     $count_job_request = request_job::where('event_id', '=', Request::input('event_id'))->where('user_id', '=', Auth::user()->id)->count();
     if ($count_job_request > 0) {
         return redirect::to("event")->with('status', "คุณได้ยื่นขอทำงานนี้แล้ว");
     } else {
         $event = event::where("id", "=", Request::input('event_id'))->first();
         $request_name = $event->event_name;
         $start_date = $event->event_date;
         $end_date = $event->event_date;
         $duration = $event->meeting_period;
         //=====================================================================================
         $request = new request_job();
         $request->request_name = $request_name;
         $request->user_id = Auth::user()->id;
         $request->start_date = $start_date;
         $request->end_date = $end_date;
         $request->duration = $duration;
         $request->event_id = Request::input('event_id');
         $request->multiple_day = 0;
         $url = "event";
         if ($request->save()) {
             return redirect::to($url)->with('status', "ยื่นขอทำงานสำเร็จ");
         } else {
             return redirect::to($url)->withInput(Request::except('password'))->withErrors("เกิดข้อผิดพลาด - ไม่สามารถยื่นขอทำงานนี้ได้ กรุณาติดต่อผู้ดูแลระบบ");
         }
     }
 }
示例#6
0
 public static function get_assign_event($date, $user_id)
 {
     $event_data = "<td valign='top'>";
     $event = event::where('event_date', '=', $date)->get();
     foreach ($event as $data) {
         //เช็คช่วงเวลา request
         if ($data->meeting_period == 2) {
             $event_color_class = "event_color_morning";
         } else {
             if ($data->meeting_period == 3) {
                 $event_color_class = "event_color_afternoon";
             } else {
                 $event_color_class = "event_color_allday";
             }
         }
         $count = Assignment::where('event_id', '=', $data->id)->where('user_id', '=', $user_id)->count();
         if ($count > 0) {
             $assignment = Assignment::where('event_id', '=', $data->id)->where('user_id', '=', $user_id)->get();
             foreach ($assignment as $data_assign) {
                 //$event_data .= "<div id='". $date ."' class='st-c st-s'>".$data_assign->id."</div>";
                 $event_data .= "<div id='" . $data->id . "' class='st-c-pos goto_assign'>\n                                  <div class='rb-n " . $event_color_class . "' >\n                                      <div class='rb-ni'>" . $data->event_name . "</div>\n                                  </div>\n                                </div>";
             }
         }
     }
     $event_data .= "</td>";
     return $event_data;
 }
示例#7
0
 public static function getuserform($id, $type)
 {
     $user = Member::orderBy('name')->get();
     if ($type == 'edit') {
         $event = event::where("id", "=", $id)->first();
         $id = $event->staff_contact_id;
     }
     echo "<select name='staff_contact_id' id='staff_contact_id' class='form-control'>";
     foreach ($user as $recode) {
         echo "<option value='" . $recode->id . "'";
         if ($id == $recode->id) {
             echo " selected='selected'";
         }
         echo ">" . $recode->nickname . " - " . $recode->name . " " . $recode->surname . "</option>";
     }
     echo "</select>";
 }
示例#8
0
 public static function get_customer_contact($id, $value)
 {
     $event = event::where("id", "=", $id)->first();
     $cus_contact_id = $event->custumer_contact_id;
     $contact = contact_person::where("id", "=", $cus_contact_id)->first();
     $datareturn = $contact->{$value};
     return $datareturn;
 }