예제 #1
0
 public static function main($user_id, $event_date)
 {
     $count = user::find($user_id)->assign($event_date)->count();
     if ($count > 0) {
         $status = "busy";
     } else {
         $status = "avaliable";
     }
     //return $status;
     //add more
     $event = user::find($user_id)->assign($event_date)->get();
     $return['userstatus'] = $status;
     if (!empty($event)) {
         foreach ($event as $row) {
             $return['event'][] = ['id' => $row->id, 'event_name' => $row->event_name, 'event_type' => $row->event_type, 'event_date' => $row->event_date];
         }
     }
     return $return;
 }
예제 #2
0
 public static function generate_page_3($event_id)
 {
     $event_job_status = even_job_status::where('id', '=', $event_id)->first();
     $topics = ["1" => "คุยรายละเอียดงาน", "2" => "จัดทำใบเสนอราคา", "3" => "ยืนยันใบเสนอราคาและรายละเอียดอุปกรณ์", "4" => "จัดเตรียมและสั่งอุปกรณ์", "5" => "แจ้งลูกค้าให้ยืนยันกับทาง TSD ว่าจะลงทะเบียนโดยใช้บาร์โค๊ด", "6" => "ขอไฟล์หนังสือเชิญที่มีเงื่อนไขการนับคะแนน (MS-Word หรือถ้าจำเป็น PDF)", "7" => "ขอไฟล์ XML รายชื่อผู้ถือหุ้น", "8" => "ขอแผนผังห้องประชุม ( Floor Plan )", "9" => "หากมีผู้มีส่วนได้ส่วนเสียในวาระไหน กรุณาแจ้งด้วย", "10" => "กรณีบัตรเสียให้ทำอย่างไร", "11" => "ขอรายชื่อกรรมการรับมอบฉันทะ", "12" => "จัดทำตัวอย่างบัตรลงคะแนน", "13" => "บันทึกไฟล์ SQL", "14" => "กรอกแบบฟอร์มวาระการประชุมและส่งให้ลูกค้าตรวจสอบ", "15" => "ยืนยันแบบฟอร์มวาระการประชุมลูกค้า (โทรเพื่อ Check ทุกอย่างที่ลูกค้ากรอกมาใน Workdetail)", "16" => "นัดชมสถานที่", "17" => "ยืนยันรายละเอียดอุปกรณ์ (Final) (โทร) \t", "18" => "ยืนยันรายละเอียดอุปกรณ์ Supplier (Final) (โทร)", "19" => "จัดทีมงานและนัดหมาย", "20" => "สรุปใบงานให้หัวหน้างาน", "21" => "ส่ง Feedback Survey"];
     $number = ["1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5.1", "6" => "5.2", "7" => "5.3", "8" => "5.4", "9" => "5.5", "10" => "5.6", "11" => "5.7", "12" => "6", "13" => "7", "14" => "8", "15" => "9", "16" => "10", "17" => "11", "18" => "12", "19" => "13", "20" => "14", "21" => "15"];
     $return_data = '<div class="container">
                   <div class="row">
                     <div class="col-md-12">
                       <h4 class="text-center">สรุปความคืบหน้า</h4>
                     </div>
                   </div>
                 </div>
                 <table class="table table-bordered table-hover table-striped">
                   <thead>
                       <tr>
                           <th class="text-center">ลำดับที่</th>
                           <th class="text-left">ชื่องาน</th>
                           <th class="text-center">สถานะ</th>
                           <th class="text-center">รับผิดชอบโดย</th>
                           <th class="text-center">แผนดำเนินการต่อไป</th>
                       </tr>
                   </thead>
                   <tbody>';
     $si = 1;
     for ($i = 1; $i <= count($topics); $i++) {
         if (count($event_job_status) > 0) {
             $status = str_replace(".", "_", $number[$i]) . "_status";
             $response = str_replace(".", "_", $number[$i]) . "_respons";
             $plan = str_replace(".", "_", $number[$i]) . "_Plan";
             $v_status = $event_job_status->{$status};
             $v_response = $event_job_status->{$response};
             $v_plan = $event_job_status->{$plan};
             switch ($v_status) {
                 case 1:
                     $v_status = "Complete";
                     break;
                 default:
                     $v_status = "";
                     break;
             }
             if ($v_response != 0) {
                 $user = user::where('id', '=', $v_response)->first();
                 $v_response = $user->nickname . " - " . $user->name . " " . $user->surname;
             } else {
                 $v_response = "";
             }
         } else {
             $v_status = "";
             $v_response = "";
             $v_plan = "";
         }
         $return_data .= '<tr>
                       <td class="text-center">' . $number[$i] . '</td>
                       <td class="text-left">' . $topics[$i] . '</td>
                       <td class="text-center">' . $v_status . '</td>
                       <td class="text-center">' . $v_response . '</td>
                       <td class="text-center">' . $v_plan . '</td>
                   </tr>';
     }
     $return_data .= '</tbody>
                 </table>';
     echo $return_data;
 }