예제 #1
0
 /**
  * @param $orderDetail
  * @return string
  */
 static function getStatusOrderDetail($orderDetail)
 {
     $orderService = new orderService();
     $statusStr = '';
     $order = $orderService->getOrderByOrderCode($orderDetail->order_code);
     if ($order->status == KACANA_ORDER_STATUS_CANCEL) {
         $statusStr = '<span class="label label-danger">đơn hàng huỷ</span>';
     } else {
         if ($orderDetail->order_detail_status == KACANA_ORDER_SERVICE_STATUS_ORDERED) {
             $statusStr = '<span class="label label-info">đã mua hàng</span>';
         } elseif ($orderDetail->order_detail_status == KACANA_ORDER_SERVICE_STATUS_SOLD_OUT) {
             $statusStr = '<span class="label label-danger">hết hàng</span>';
         } elseif ($orderDetail->order_detail_status == KACANA_ORDER_SERVICE_STATUS_SHIPPING) {
             if (isset($orderDetail->payment_id)) {
                 $statusStr = '<span class="label label-success">đã chuyển tiền </span><br><span class="text-red" >code ' . $orderDetail->payment_code . '</span>';
             } else {
                 if (!isset($orderDetail->shipping_service_code)) {
                     $orderDetail->shipping_service_code = '';
                 }
                 $statusStr = \Kacana\ViewGenerateHelper::getStatusDescriptionShip($orderDetail->shipping_status, $orderDetail->shipping_service_code) . '<br><span class="text-green" >ship code ' . $orderDetail->shipping_service_code . '</span>';
             }
         } else {
             $statusStr = '<span class="label label-primary">chưa xử lý</span>';
         }
     }
     return $statusStr;
 }
예제 #2
0
 /**
  * Generate tag table for user
  *
  * @param $request
  * @return array
  */
 public function generatetagTable($request)
 {
     $tagModel = new tagModel();
     $datatables = new DataTables();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'tags.id', 'dt' => 0), array('db' => 'tags.name', 'dt' => 1), array('db' => 'tags.status', 'dt' => 2), array('db' => 'tags.created', 'dt' => 3), array('db' => 'tags.updated', 'dt' => 4));
     $return = $tagModel->generateTagTable($request, $columns);
     $optionStatus = [KACANA_TAG_STATUS_ACTIVE, KACANA_TAG_STATUS_INACTIVE];
     if (count($return['data'])) {
         foreach ($return['data'] as &$res) {
             $res->status = $viewHelper->dropdownView('tags', $res->id, $res->status, 'status', $optionStatus);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }
예제 #3
0
 public function detail(Request $request)
 {
     $orderService = new orderService();
     $addressService = new addressService();
     $shipService = new shipService();
     $shippingId = $request->input('id');
     try {
         $status = $shipService->GetOrderInfoStatus($shippingId);
         $ship = $shipService->updateShippingStatus($shippingId, $status);
         $ship->statusDesc = ViewGenerateHelper::getStatusDescriptionShip($status, $shippingId);
         $user_address = $ship->addressReceive;
         $cities = $addressService->getListCity()->lists('name', 'id');
         $districts = $addressService->getListDistrict();
         return view('admin.shipping.detail', compact('ship', 'user_address', 'cities', 'districts'));
     } catch (\Exception $e) {
         // @codeCoverageIgnoreStart
         $return['error'] = $e->getMessage();
         $return['errorMsg'] = $e->getMessage();
         // @codeCoverageIgnoreEnd
     }
 }
예제 #4
0
 /**
  * @param $request
  * @return array
  */
 public function reportDetailTableUser($request)
 {
     $userModel = new User();
     $datatables = new DataTables();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'users.id', 'dt' => 0), array('db' => 'users.name', 'dt' => 1), array('db' => 'users.email', 'dt' => 2), array('db' => 'users.phone', 'dt' => 3), array('db' => 'users.role', 'dt' => 4), array('db' => 'users.status', 'dt' => 5), array('db' => 'users.created', 'dt' => 6), array('db' => 'users.updated_at', 'dt' => 7));
     $return = $userModel->reportDetailTableUser($request, $columns);
     if (count($return['data'])) {
         $optionStatus = [KACANA_TAG_STATUS_ACTIVE, KACANA_USER_STATUS_INACTIVE, KACANA_USER_STATUS_BLOCK, KACANA_USER_STATUS_CREATE_BY_SYSTEM];
         $optionRole = [KACANA_USER_ROLE_ADMIN, KACANA_USER_ROLE_BUYER];
         foreach ($return['data'] as &$res) {
             $res->status = $viewHelper->dropdownView('users', $res->id, $res->status, 'status', $optionStatus);
             $res->role = $viewHelper->dropdownView('users', $res->id, $res->role, 'role', $optionRole);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }
예제 #5
0
 public function generateShippingTable($request)
 {
     $shippingModel = new shippingModel();
     $datatables = new DataTables();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'shipping.id', 'dt' => 0), array('db' => 'address_receive.name', 'dt' => 1), array('db' => 'shipping.total', 'dt' => 2), array('db' => 'shipping.fee', 'dt' => 3), array('db' => 'shipping.expected_delivery_time', 'dt' => 4), array('db' => 'shipping.status', 'dt' => 5), array('db' => 'shipping.created', 'dt' => 6), array('db' => 'shipping.updated', 'dt' => 7));
     $return = $shippingModel->generateShippingTable($request, $columns);
     if (count($return['data'])) {
         $optionStatus = [KACANA_ORDER_STATUS_NEW, KACANA_ORDER_STATUS_PROCESSING, KACANA_ORDER_STATUS_CANCEL, KACANA_ORDER_STATUS_COMPLETE];
         foreach ($return['data'] as &$res) {
             $res->status = $viewHelper->getStatusDescriptionShip($res->status, $res->id);
             $res->total = formatMoney($res->total);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }
예제 #6
0
 /**
  * @param $request
  * @return array
  */
 public function generateProductTagTable($request)
 {
     $productModel = new productModel();
     $datatables = new DataTables();
     $tagService = new tagService();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'products.id', 'dt' => 0), array('db' => 'products.name', 'dt' => 1), array('db' => 'products.price', 'dt' => 2), array('db' => 'products.sell_price', 'dt' => 3), array('db' => 'products.status', 'dt' => 4), array('db' => 'products.created', 'dt' => 5), array('db' => 'products.updated', 'dt' => 6));
     $subTag = $tagService->getAllChildTag($request['tagId']);
     $return = $productModel->generateProductTagTable($subTag, $request, $columns);
     $statusOptions = [KACANA_PRODUCT_STATUS_ACTIVE, KACANA_PRODUCT_STATUS_INACTIVE];
     if (count($return['data'])) {
         foreach ($return['data'] as &$res) {
             $res->status = $viewHelper->dropdownView('products', $res->id, $res->status, 'status', $statusOptions);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }
예제 #7
0
 public function reportDetailTableOrder($request)
 {
     $orderModel = new orderModel();
     $datatables = new DataTables();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'orders.id', 'dt' => 0), array('db' => 'users.name', 'dt' => 1), array('db' => 'users.phone', 'dt' => 2), array('db' => 'orders.total', 'dt' => 3), array('db' => 'orders.quantity', 'dt' => 4), array('db' => 'orders.status', 'dt' => 5), array('db' => 'orders.created', 'dt' => 6), array('db' => 'orders.updated', 'dt' => 7));
     $return = $orderModel->reportDetailTableOrder($request, $columns);
     if (count($return['data'])) {
         $optionStatus = [KACANA_ORDER_STATUS_NEW, KACANA_ORDER_STATUS_PROCESSING, KACANA_ORDER_STATUS_CANCEL, KACANA_ORDER_STATUS_COMPLETE];
         foreach ($return['data'] as &$res) {
             $res->status = $viewHelper->dropdownView('orders', $res->id, $res->status, 'status', $optionStatus);
             $res->total = formatMoney($res->total);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }