feat: 전화접수 관리 기간조회·지정판매소 정보 패널 + 날짜 입력 월 한글화
- 전화접수 관리: 접수일 기간 조회 필터, 선택 주문의 지정판매소 정보(코드·담당자·전화·주소) + 접수 품목 내역 표시, 상단 '전화 주문 접수' 버튼 제거 - 전 화면 날짜 입력(date/month 등)에 lang=ko 지정 → 달력 월을 한글(6월)로 표시 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7022,12 +7022,26 @@ SQL;
|
||||
return redirect()->to(site_url('bag/sales'))->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
// 일자별·기간별 조회 (접수일 so_order_date 기준)
|
||||
$startDate = trim((string) ($this->request->getGet('start_date') ?? ''));
|
||||
$endDate = trim((string) ($this->request->getGet('end_date') ?? ''));
|
||||
$isYmd = static fn (string $d): bool => preg_match('/^\d{4}-\d{2}-\d{2}$/', $d) === 1;
|
||||
if ($isYmd($startDate) && $isYmd($endDate) && $startDate > $endDate) {
|
||||
[$startDate, $endDate] = [$endDate, $startDate];
|
||||
}
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$orderModel = model(ShopOrderModel::class);
|
||||
$builder = $orderModel->where('so_lg_idx', $lgIdx);
|
||||
if ($db->fieldExists('so_channel', 'shop_order')) {
|
||||
$builder->where('so_channel', 'phone');
|
||||
}
|
||||
if ($isYmd($startDate)) {
|
||||
$builder->where('so_order_date >=', $startDate);
|
||||
}
|
||||
if ($isYmd($endDate)) {
|
||||
$builder->where('so_order_date <=', $endDate . ' 23:59:59');
|
||||
}
|
||||
$orders = $builder->orderBy('so_idx', 'DESC')->limit(200)->findAll();
|
||||
|
||||
$orderIds = array_values(array_map(static fn ($o): int => (int) ($o->so_idx ?? 0), $orders));
|
||||
@@ -7056,6 +7070,25 @@ SQL;
|
||||
];
|
||||
}
|
||||
|
||||
// 주문의 지정판매소 상세(코드·담당자·전화·주소) — 우측 '지정판매소 정보' 표시용
|
||||
$shopMap = [];
|
||||
$dsIdxs = array_values(array_unique(array_filter(array_map(static fn ($o): int => (int) ($o->so_ds_idx ?? 0), $orders), static fn ($v): bool => $v > 0)));
|
||||
if ($dsIdxs !== [] && $db->tableExists('designated_shop')) {
|
||||
$shopRows = $db->table('designated_shop')
|
||||
->select('ds_idx, ds_shop_no, ds_name, ds_rep_name, ds_tel, ds_addr, ds_addr_detail')
|
||||
->whereIn('ds_idx', $dsIdxs)
|
||||
->get()->getResultArray();
|
||||
foreach ($shopRows as $s) {
|
||||
$shopMap[(int) $s['ds_idx']] = [
|
||||
'shop_no' => (string) ($s['ds_shop_no'] ?? ''),
|
||||
'name' => (string) ($s['ds_name'] ?? ''),
|
||||
'rep_name' => (string) ($s['ds_rep_name'] ?? ''),
|
||||
'tel' => (string) ($s['ds_tel'] ?? ''),
|
||||
'addr' => trim((string) ($s['ds_addr'] ?? '') . ' ' . (string) ($s['ds_addr_detail'] ?? '')),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$itemsByOrder = [];
|
||||
foreach ($itemRows as $item) {
|
||||
$orderId = (int) ($item->soi_so_idx ?? 0);
|
||||
@@ -7079,9 +7112,16 @@ SQL;
|
||||
$payload = [];
|
||||
foreach ($orders as $order) {
|
||||
$id = (int) ($order->so_idx ?? 0);
|
||||
$dsIdx = (int) ($order->so_ds_idx ?? 0);
|
||||
$shop = $shopMap[$dsIdx] ?? ['shop_no' => '', 'name' => '', 'rep_name' => '', 'tel' => '', 'addr' => ''];
|
||||
$payload[] = [
|
||||
'so_idx' => $id,
|
||||
'so_ds_idx' => $dsIdx,
|
||||
'so_ds_name' => (string) ($order->so_ds_name ?? ''),
|
||||
'ds_shop_no' => $shop['shop_no'],
|
||||
'ds_rep_name' => $shop['rep_name'],
|
||||
'ds_tel' => $shop['tel'],
|
||||
'ds_addr' => $shop['addr'],
|
||||
'so_order_date' => (string) ($order->so_order_date ?? ''),
|
||||
'so_delivery_date' => (string) ($order->so_delivery_date ?? ''),
|
||||
'so_payment_type' => (string) ($order->so_payment_type ?? ''),
|
||||
@@ -7093,7 +7133,9 @@ SQL;
|
||||
}
|
||||
|
||||
return $this->render('전화접수 관리', 'bag/order_phone_manage', [
|
||||
'orders' => $payload,
|
||||
'orders' => $payload,
|
||||
'startDate' => $isYmd($startDate) ? $startDate : '',
|
||||
'endDate' => $isYmd($endDate) ? $endDate : '',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user