diff --git a/route.php b/route.php
index 2b099ae..f51cf21 100644
--- a/route.php
+++ b/route.php
@@ -60,7 +60,8 @@ if (ATOM_ENABLED) {
if (OPENPROVIDER_ENABLED) {
$routes[] = Route::add('GET', 'openprovider', Op::class.'@index');
- $routes[] = Route::add('GET', 'openprovider/listcustomer', Op::class.'@opListCustomers');
+ $routes[] = Route::add('GET', 'openprovider/listcustomers', Op::class.'@opListCustomers');
+ $routes[] = Route::add('GET', 'openprovider/getcustomer/{handle}', Op::class.'@opGetCustomer');
$routes[] = Route::add('GET', 'openprovider/listtlds', Op::class.'@opListTlds');
$routes[] = Route::add('GET', 'openprovider/gettld/{tld}', Op::class.'@opGetTld');
$routes[] = Route::add('GET', 'openprovider/checkdomain', Op::class.'@opCheckDomainAvailable');
diff --git a/src/Site/Controller/Op.php b/src/Site/Controller/Op.php
index fe371a9..5f7bee2 100644
--- a/src/Site/Controller/Op.php
+++ b/src/Site/Controller/Op.php
@@ -63,7 +63,47 @@ class Op {
$tmpl->assign('data', $data->data);
$tmpl->addCss('table');
- $tmpl->render('listcustomer');
+ $tmpl->render('listcustomers');
+ exit();
+
+ noaccess:
+ $tmpl->render('nopermission');
+ } catch (\Exception $e) {
+ throw new \Exception($e->getMessage());
+ }
+ }
+
+ public function opGetCustomer(array $params): void {
+ try {
+ $handle = '';
+ if (isset($params['handle'])) $handle = $params['handle'];
+ if ($handle === '') {
+ header('Location: /openprovider/listcustomers');
+ exit();
+ }
+ $tmpl = new Template('/openprovider/');
+ $pagetit = "OpenProvider管理 - 顧客様「{$handle}」の表示";
+ $description = '';
+
+ // ユーザー
+ $auth = new Auth();
+ $user = $auth->getLoggedInUser();
+ $tmpl->assign('user', $user);
+
+ $tmpl->assign('pagetit', $pagetit);
+ $tmpl->assign('curPage', 'openprovider');
+ $tmpl->assign('custCss', true);
+ $tmpl->assign('menu', $this->getMenu());
+ $tmpl->assign('description', $description);
+
+ if (!$user || $user->role !== \Roles::ADMIN) goto noaccess;
+ $op = new Openprovider();
+ $op->login();
+ $data = $op->getCustomer($handle, true);
+ $tmpl->assign('data', $data->data);
+
+ $tmpl->addCss('table');
+ $tmpl->render('getcustomer');
exit();
noaccess:
diff --git a/src/Std/Lib/Openprovider.php b/src/Std/Lib/Openprovider.php
index c1ffbd0..bd9c782 100644
--- a/src/Std/Lib/Openprovider.php
+++ b/src/Std/Lib/Openprovider.php
@@ -199,7 +199,7 @@ class Openprovider {
//// 顧客様の追加データ
/**
- * 顧客様の検索
+ * 顧客様の一覧
*
* @param array $query 検索クエリー
* @return Result
@@ -219,7 +219,34 @@ class Openprovider {
return \Result::Success('', $res->data);
}
- return \Result::Error('TLD一覧の受け取りに失敗。');
+ return \Result::Error('顧客様一覧の受け取りに失敗。');
+ }
+
+ /**
+ * 顧客様の表示
+ *
+ * @param string $handle ハンドル
+ * @param bool $withAdditionalData 詳細データ含むか?
+ * @return Result
+ */
+ public function getCustomer(string $handle, bool $withAdditionalData = false): \Result {
+ if (!OPENPROVIDER_ENABLED) return \Result::error('エラー:OpenProviderは無効です。');
+ $cacheName = "getcustomer-{$handle}";
+ $cache = $this->getCache($cacheName);
+ if (!empty($cache) && (isset($cache['handle']) && $cache['handle'] === $handle)) return \Result::Success('', $cache);
+
+ $query = [ 'with_additional_data' => $withAdditionalData ? 'true' : 'false' ];
+ $uri = "/customers/{$handle}?".http_build_query($query, '', '&', PHP_QUERY_RFC3986);
+ // kys($uri);
+ $curl = $this->setupCurl($uri);
+ $res = $this->curlResult($curl);
+ if (isset($res->data['data'])) {
+ $res->data['handle'] = $handle;
+ $this->setCache($cacheName, $res->data);
+ return \Result::Success('', $res->data);
+ }
+
+ return \Result::Error('顧客様の受け取りに失敗。');
}
//// ドメイン値段
diff --git a/view/openprovider/getcustomer.maron b/view/openprovider/getcustomer.maron
new file mode 100644
index 0000000..af94748
--- /dev/null
+++ b/view/openprovider/getcustomer.maron
@@ -0,0 +1,112 @@
+{@ include(common/header) @}
+ 顧客様の削除
+ 顧客様のクローン
+ 顧客様の編集
+
連絡先:{{ $data['data']['name']['full_name'] }} ({{ $data['data']['handle'] }})
+
+
+
+ | ID |
+ {{ $data['data']['id'] }} |
+
+
+ | リセラーID |
+ {{ $data['data']['reseller_id'] }} |
+
+
+ | ハンドル |
+ {{ $data['data']['handle'] }} |
+
+
+ | イニシャル |
+ |
+
+
+ | フルネーム |
+ {{ $data['data']['name']['last_name'].' '.$data['data']['name']['first_name'] }} |
+
+
+ | 生まれた場所 |
+ 〒{{ $data['data']['additional_data']['birth_zipcode'].' '.$data['data']['additional_data']['birth_city'].' '.$data['data']['additional_data']['birth_address'].' '.$data['data']['additional_data']['birth_country'] }} |
+
+
+ | 生年月日 |
+ {{ $data['data']['additional_data']['birth_date'] }} |
+
+
+ | 電話番号 |
+ {{ $data['data']['phone']['country_code'].$data['data']['phone']['area_code'].$data['data']['phone']['subscriber_number'] }} |
+
+
+ | FAX |
+ {{ $data['data']['fax']['country_code'].$data['data']['fax']['area_code'].$data['data']['fax']['subscriber_number'] }} |
+
+
+ | メールアドレス |
+ {{ $data['data']['email'] }} |
+
+
+
+ 会社情報
+
+
+
+ | 会社名 |
+ {{ $data['data']['company_name'] }} |
+
+
+ | VAT番号 |
+ {{ $data['data']['vat'] }} |
+
+
+ | 会社登録番号 |
+ {{ $data['data']['additional_data']['company_registration_number'] }} |
+
+
+ | 会社登録場所 |
+ {{ $data['data']['additional_data']['company_registration_city'] }} |
+
+
+ | 会社登録日 |
+ {{ $data['data']['additional_data']['company_registration_subscription_date'] }} |
+
+
+ | 会社URL |
+ {{ $data['data']['additional_data']['company_url'] }} |
+
+
+
+ 住所情報
+
+
+
+ | 道+番号 |
+ {{ $data['data']['address']['street'].$data['data']['address']['number'].' '.$data['data']['address']['suffix'] }} |
+
+
+ | 郵便番号 |
+ {{ $data['data']['address']['zipcode'] }} |
+
+
+ | 市区町村 |
+ {{ $data['data']['address']['city'] }} |
+
+
+ | 都道府県 |
+ {{ $data['data']['address']['state'] }} |
+
+
+ | 国 |
+ {{ $data['data']['address']['country'] }} |
+
+
+ | 言語 |
+ {{ $data['data']['locale'] }} |
+
+
+ | 本社の場所 |
+ 〒{{ $data['data']['additional_data']['headquarters_zipcode'].' '.$data['data']['additional_data']['headquarters_city'].' '.$data['data']['additional_data']['headquarters_address'].' '.$data['data']['additional_data']['headquarters_country'] }} |
+
+
+
+{@ include(common/footer) @}
\ No newline at end of file
diff --git a/view/openprovider/index.maron b/view/openprovider/index.maron
index 78f4bf4..81d36f9 100644
--- a/view/openprovider/index.maron
+++ b/view/openprovider/index.maron
@@ -3,7 +3,7 @@
- 顧客様
- ドメイン
diff --git a/view/openprovider/listcustomer.maron b/view/openprovider/listcustomers.maron
similarity index 93%
rename from view/openprovider/listcustomer.maron
rename to view/openprovider/listcustomers.maron
index d14287d..3b1bc70 100644
--- a/view/openprovider/listcustomer.maron
+++ b/view/openprovider/listcustomers.maron
@@ -1,4 +1,5 @@
{@ include(common/header) @}
+ 顧客様の追加
検索
{@ if (isset($data['data']['results'])) @}