diff --git a/.env b/.env index 5ebf6e4..e4130e3 100644 --- a/.env +++ b/.env @@ -2,8 +2,7 @@ APP_NAME=so-manager APP_ENV=local APP_KEY=base64:ejLwJbt2bEXY9emPUmsurG+X1hzkjTxQQvq2/FO14RY= APP_DEBUG=true -APP_URL=https://krgm.so-manager-dev.com/ - +APP_URL=https://main-sou.so-manager-dev.com/ APP_LOCALE=ja APP_FALLBACK_LOCALE=ja APP_FAKER_LOCALE=ja_JP diff --git a/.gitea/workflows/deploy-preview.yml b/.gitea/workflows/deploy-preview.yml new file mode 100644 index 0000000..cdae5f6 --- /dev/null +++ b/.gitea/workflows/deploy-preview.yml @@ -0,0 +1,20 @@ +name: Deploy preview (main_sou) + +on: + push: + branches: ["main_sou"] + workflow_dispatch: + +concurrency: + group: deploy-main_sou + cancel-in-progress: true + +jobs: + deploy: + runs-on: ["native"] + steps: + - uses: actions/checkout@v4 + - name: Deploy to preview (main_sou) + env: + BRANCH: main_sou + run: /usr/local/bin/deploy_branch_simple.sh \ No newline at end of file diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index 976e13c..0000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Deploy krgm (auto) - -on: - push: - branches: [ "main" ] - workflow_dispatch: - -jobs: - deploy: - runs-on: [ "native" ] - steps: - - uses: actions/checkout@v4 - - name: Deploy to server - run: /usr/local/bin/deploy_krgm.sh \ No newline at end of file diff --git a/app/Http/Controllers/Admin/PplaceController.php b/app/Http/Controllers/Admin/PplaceController.php new file mode 100644 index 0000000..7134d41 --- /dev/null +++ b/app/Http/Controllers/Admin/PplaceController.php @@ -0,0 +1,175 @@ + 0, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + 'page' => $request->get('page', 1), + ]; + + $inputs['list'] = Pplace::search($inputs); + + if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) { + return redirect()->route('pplace'); + } + + return view('admin.Pplace.list', $inputs); + } + + public function add(Request $request) + { + $inputs = [ + 'pplace_number' => $request->input('pplace_number'), + 'pplace_remarks' => $request->input('pplace_remarks'), + 'operator_id' => $request->input('operator_id'), + ]; + + $inputs['operators'] = Ope::getList(); // + + if ($request->isMethod('POST')) { + $validator = Validator::make($inputs, [ + 'pplace_number' => 'required|string|max:255', + 'pplace_remarks' => 'nullable|string|max:255', + 'operator_id' => 'nullable|integer', + ]); + + if (!$validator->fails()) { + DB::transaction(function () use ($inputs) { + $pplace = new Pplace(); + $pplace->fill($inputs); + $pplace->save(); + }); + return redirect()->route('pplace')->with('success', '登録成功'); + } else { + $inputs['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + + return view('admin.Pplace.add', $inputs); + } + + public function edit(Request $request, $id, $view = '') + { + + $record = Pplace::find($id); + + if (!$record) abort(404); + + $data = $record->toArray(); + $data['operators'] = Ope::getList(); + + + if ($request->isMethod('POST')) { + $inputs = $request->all(); + $validator = Validator::make($inputs, [ + 'pplace_number' => 'required|string|max:255', + 'pplace_remarks' => 'nullable|string|max:255', + 'operator_id' => 'nullable|integer', + ]); + + $data = array_merge($data, $inputs); + + if (!$validator->fails()) { + DB::transaction(function () use ($record, $inputs) { + $record->fill($inputs); + $record->save(); + }); + return redirect()->route('pplace')->with('success', '更新成功'); + } else { + $data['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + + return view($view ?: 'admin.Pplace.edit', $data); + } + + public function info(Request $request, $id) + { + return $this->edit($request, $id, 'admin.Pplace.info'); + } + + public function delete(Request $request) + { + $pk = $request->get('pk'); + if ($pk && Pplace::destroy($pk)) { + return redirect()->route('pplace')->with('success', '削除成功'); + } + return redirect()->route('pplace')->with('error', '削除失敗'); + } + + public function export() + { + $headers = [ + "Content-type" => "text/csv;charset=UTF-8", + "Content-Disposition" => "attachment; filename=Pplace.csv", + ]; + + $data = Pplace::all(); + $columns = ['ID', '番号', '備考', 'オペレータID']; + + $filename = "Pplace.csv"; + $file = fopen($filename, 'w+'); + fputcsv($file, $columns); + + foreach ($data as $item) { + fputcsv($file, [ + $item->pplace_id, + $item->pplace_number, + $item->pplace_remarks, + $item->operator_id, + ]); + } + + fclose($file); + return Response::download($filename, $filename, $headers); + } + + public function import(Request $request) + { + $file = $request->file('file'); + if (!$file) { + return redirect()->route('pplace')->with('error', 'CSVファイルを選択してください'); + } + + $data = \App\Utils::csvToArray($file); + $record = 0; + + DB::beginTransaction(); + try { + foreach ($data as $key => $row) { + $record = $key + 2; + if (count($row) < 3) throw new \Exception('列数が不正です'); + + Pplace::create([ + 'pplace_number' => $row[0], + 'pplace_remarks' => $row[1], + 'operator_id' => $row[2], + ]); + } + DB::commit(); + return redirect()->route('pplace')->with('success', 'インポート成功'); + } catch (\Exception $e) { + DB::rollBack(); + return redirect()->route('pplace')->with('error', "行 {$record} : " . $e->getMessage()); + } + } + + private function __buildErrorMessasges($validator) + { + return implode("\n", $validator->errors()->all()); + } +} diff --git a/app/Http/Controllers/Admin/RegularContractController.php b/app/Http/Controllers/Admin/RegularContractController.php new file mode 100644 index 0000000..a5d05cd --- /dev/null +++ b/app/Http/Controllers/Admin/RegularContractController.php @@ -0,0 +1,408 @@ + 0, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + 'page' => $request->get('page', 1), + ]; + $inputs['list'] = RegularContract::search($inputs); + //dd($inputs['list']->items()); + +// dd($inputs); + if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) { + return redirect()->route('regular_contracts'); + } + return view('admin.regular_contracts.list', $inputs); + } + + public function add(Request $request) + { + $inputs = [ + 'contract_qr_id' => $request->input('contract_qr_id'), // 定期契約QRID + 'user_id' => $request->input('user_id'), // 利用者ID + 'user_categoryid' => $request->input('user_categoryid'), // 利用者分類ID + 'reserve_id' => $request->input('reserve_id'), // 定期予約ID + 'park_id' => $request->input('park_id'), // 駐輪場ID + 'price_parkplaceid' => $request->input('price_parkplaceid'), // 駐輪場所ID + 'user_securitynum' => $request->input('user_securitynum'), // 防犯登録番号 + 'reserve_date' => $request->input('reserve_date'), // 予約日時 + 'contract_reserve' => $request->input('contract_reserve'), // 予約移行フラグ + 'contract_created_at' => $request->input('contract_created_at'), // 契約日時 + 'contract_updated_at' => $request->input('contract_updated_at'), // 更新可能日 + 'contract_cancelday' => $request->input('contract_cancelday'), // 解約日時 + 'contract_reduction' => $request->input('contract_reduction'), // 減免措置 + 'contract_periods' => $request->input('contract_periods'), // 有効期間S + 'contract_periode' => $request->input('contract_periode'), // 有効期間E + 'contract_taxid' => $request->input('contract_taxid'), // 消費税ID + 'billing_amount' => $request->input('billing_amount'), // 請求金額 + 'contract_payment_day' => $request->input('contract_payment_day'), // 授受日時 + 'contract_money' => $request->input('contract_money'), // 授受金額 + 'refunds' => $request->input('refunds'), // 解約時返戻金 + 'refunds_comment' => $request->input('refunds_comment'), // 返戻金付随情報 + 'repayment_at' => $request->input('repayment_at'), // 返金日 + 'contact_guid' => $request->input('contact_guid'), // 決済コード + 'contact_shop_code' => $request->input('contact_shop_code'), // 店舗コード + 'contract_cvs_class' => $request->input('contract_cvs_class'), // 授受種別 + 'contract_flag' => $request->input('contract_flag'), // 授受フラグ + 'settlement_transaction_id' => $request->input('settlement_transaction_id'), // 決済トランザクションID + 'contract_seal_issue' => $request->input('contract_seal_issue'), // シール発行数 + 'seal_reissue_request' => $request->input('seal_reissue_request'), // シール再発行リクエスト + 'contract_permission' => $request->input('contract_permission'), // シール発行許可 + 'contract_cancel_flag' => $request->input('contract_cancel_flag'), // 解約フラグ + 'tag_qr_flag' => $request->input('tag_qr_flag'), // タグ/QRフラグ + 'tag_change_flag' => $request->input('tag_change_flag'), // オペレータータグ変更フラグ + 'park_position' => $request->input('park_position'), // 駐輪位置番号 + 'ope_id' => $request->input('ope_id'), // オペレータID + 'contract_manual' => $request->input('contract_manual'), // 手動通知 + 'contract_notice' => $request->input('contract_notice'), // 通知方法 + 'contract_payment_number' => $request->input('contract_payment_number'), // 受付番号 + 'created_at' => $request->input('created_at'), + 'updated_at' => $request->input('updated_at'), + ]; + $dataList = $this->getDataDropList(); + $inputs = array_merge($inputs, $dataList); + if ($request->isMethod('POST')) { + $type = false; + $validation = new RegularContractRequest(); + $rules = $validation->rules(); + if(!empty($inputs['billing_amount']) ){ + $rules['billing_amount'] = 'numeric|between:0,999999999999.99'; + } + if(!empty($inputs['contract_money']) ){ + $rules['contract_money'] = 'numeric|between:0,999999999999.99'; + } + if(!empty($inputs['user_aid']) ){ + $rules['refunds'] ='numeric|between:0,999999999999.99'; + } + if(!empty($inputs['settlement_transaction_id']) ){ + $rules['settlement_transaction_id'] = 'integer'; + } + if(!empty($inputs['contract_seal_issue']) ){ + $rules['contract_seal_issue'] = 'integer'; + } + if(!empty($inputs['ope_id']) ){ + $rules['ope_id'] = 'integer'; + } + $validator = Validator::make($request->all(), $rules, $validation->messages()); + if (!$validator->fails()) { + \DB::transaction(function () use ($inputs, &$type) { + $new = new RegularContract(); + $new->fill($inputs); + if ($new->save()) { + $type = true; + } + + }); + if ($type) { + $request->session()->flash('success', __('新しい成功を創造する。')); + return redirect()->route('regular_contracts'); + } else { + $request->session()->flash('error', __('新しい作成に失敗しました')); + } + } else { + $inputs['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + + return view('admin.regular_contracts.add', $inputs); + } + + public function edit(Request $request, $contract_id, $view = '') + { + $regular_contract = RegularContract::getByPk($contract_id); + if (empty($contract_id) || empty($regular_contract)) { + abort('404'); + } + $data = $regular_contract->getAttributes(); + $dataList = $this->getDataDropList(); + $data = array_merge($data, $dataList); + if ($request->isMethod('POST')) { + $type = false; + $inputs = $request->all(); + $validation = new RegularContractRequest(); + $rules = $validation->rules(); + if(!empty($inputs['billing_amount']) ){ + $rules['billing_amount'] = 'numeric|between:0,999999999999.99'; + } + if(!empty($inputs['contract_money']) ){ + $rules['contract_money'] = 'numeric|between:0,999999999999.99'; + } + if(!empty($inputs['user_aid']) ){ + $rules['refunds'] ='numeric|between:0,999999999999.99'; + } + if(!empty($inputs['settlement_transaction_id']) ){ + $rules['settlement_transaction_id'] = 'integer'; + } + if(!empty($inputs['contract_seal_issue']) ){ + $rules['contract_seal_issue'] = 'integer'; + } + if(!empty($inputs['ope_id']) ){ + $rules['ope_id'] = 'integer'; + } + $validator = Validator::make($inputs, $rules, $validation->messages()); + $data = array_merge($data, $inputs); + if (!$validator->fails()) { + \DB::transaction(function () use ($data, &$type, $regular_contract) { + $regular_contract->fill($data); + $regular_contract->save(); + $type = true; + }); + if ($type) { + $request->session()->flash('success', __('更新に成功しました')); + return redirect()->route('regular_contracts'); + } else { + $request->session()->flash('error', __('更新に失敗しました')); + } + } else { + $data['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + if ($view != '') { + return view($view, $data); + } + return view('admin.regular_contracts.edit', $data); + } + + public function delete(Request $request) + { + $arr_pk = $request->get('pk'); + if ($arr_pk) { + if (RegularContract::deleteByPk($arr_pk)) { + return redirect()->route('regular_contracts')->with('success', __("削除が完了しました。")); + } else { + return redirect()->route('regular_contracts')->with('error', __('削除に失敗しました。')); + } + } + return redirect()->route('regular_contracts')->with('error', __('削除するユーザーを選択してください。')); + } + + public function info(Request $request, $contract_id) + { + return $this->edit($request, $contract_id, 'admin.regular_contracts.info'); + } + + public function getDataDropList() + { + $data['users'] = User::getList(); + $data['listUserType'] = Usertype::getList(); + $data['park'] = Park::getList(); + return $data; + } + + + public function export(Request $request) + { + + $headers = array( + "Content-type" => "text/csv;charset=UTF-8", + 'Content-Encoding: UTF-8', + "Content-Disposition" => "attachment; filename=file.csv", + "Pragma" => "no-cache", + "Cache-Control" => "must-revalidate, post-check=0, pre-check=0", + "Expires" => "0" + ); + $inputs = [ + 'isMethodPost' => 0, + 'isExport' => 1, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + + ]; + + $dataExport = RegularContract::search($inputs); + $columns = array( + __('定期契約ID'), + __('定期契約QRID'),// 1 + __('利用者ID'),// 2 + __('利用者分類ID'),// 3 + __('定期予約ID'),// 4 + __('駐輪場ID'),// 5 + __('駐輪場所ID'),// 6 + __('防犯登録番号'),// 7 + __('予約日時'),// 8 + __('予約移行フラグ'),// 9 + __('契約日時'),// 10 + __('更新可能日'),// 11 + __('解約日時'),// 12 + __('減免措置'),// 13 + __('有効期間S'),// 14 + __('有効期間E'),// 15 + __('消費税ID'),// 16 + __('請求金額'),// 17 + __('授受日時'),// 18 + __('授受金額'),// 19 + __('解約時返戻金'),// 20 + __('返戻金付随情報'),// 21 + __('返金日'),// 22 + __('決済コード'),// 23 + __('店舗コード'),// 24 + __('授受種別'),// 25 + __('授受フラグ'),// 26 + __('決済トランザクションID'),// 27 + __('シール発行数'),// 28 + __('シール再発行リクエスト'),// 29 + __('シール発行許可'),// 30 + __('解約フラグ'),// 31 + __('タグ/QRフラグ'),// 32 + __('オペレータータグ変更フラグ'),// 33 + __('駐輪位置番号'),// 34 + __('オペレータID'),// 35 + __('手動通知'),// 36 + __('通知方法'),// 37 + __('受付番号'),// 38 + ); + $filename = "定期契約マスタ.csv"; + $file = fopen($filename, 'w+'); + fputcsv($file, $columns); + foreach ($dataExport as $items) { + fputcsv($file, array( + $items->contract_id, // 0 + $items->contract_qr_id, // 1 + $items->user_id, // 2 + $items->user_categoryid, // 3 + $items->reserve_id, // 4 + $items->park_id, // 5 + $items->price_parkplaceid, // 6 + $items->user_securitynum, // 7 + $items->reserve_date, // 8 + $items->contract_reserve, // 9 + $items->contract_created_at, // 10 + $items->contract_updated_at, // 11 + $items->contract_cancelday, // 12 + $items->contract_reduction, // 13 + $items->contract_periods, // 14 + $items->contract_periode, // 15 + $items->contract_taxid, // 16 + $items->billing_amount, // 17 + $items->contract_payment_day, // 18 + $items->contract_money, // 19 + $items->refunds, // 20 + $items->refunds_comment, // 21 + $items->repayment_at, // 22 + $items->contact_guid, // 23 + $items->contact_shop_code, // 24 + $items->contract_cvs_class, // 25 + $items->contract_flag, // 26 + $items->settlement_transaction_id, // 27 + $items->contract_seal_issue, // 28 + $items->seal_reissue_request, // 29 + $items->contract_permission, // 30 + $items->contract_cancel_flag, // 31 + $items->tag_qr_flag, // 32 + $items->tag_change_flag, // 33 + $items->park_position, // 34 + $items->ope_id, // 35 + $items->contract_manual, // 36 + $items->contract_notice, // 37 + $items->contract_payment_number, // 38 + ) + ); + } + fclose($file); + return Response::download($filename, $filename, $headers); + } + + public function import(Request $request) + { + $file = $request->file('file'); + if (!empty($file)) { + $data = Utils::csvToArray($file); + $type = 1; + $msg = ''; + $record = 0; + DB::beginTransaction(); + try { + RegularContract::query()->delete(); + $col = 39; + foreach ($data as $key => $items) { + $record = $key + 2; + if (count($items) == $col) { + $row = new RegularContract(); + $row->contract_id = $items[0]; + $row->contract_qr_id = $items[1]; + $row->user_id = $items[2]; + $row->user_categoryid = $items[3]; + $row->reserve_id = $items[4]; + $row->park_id = $items[5]; + $row->price_parkplaceid = $items[6]; + $row->user_securitynum = $items[7]; + $row->reserve_date = $items[8]; + $row->contract_reserve = $items[9]; + $row->contract_created_at = $items[10]; + $row->contract_updated_at = $items[11]; + $row->contract_cancelday = $items[12]; + $row->contract_reduction = $items[13]; + $row->contract_periods = $items[14]; + $row->contract_periode = $items[15]; + $row->contract_taxid = $items[16]; + $row->billing_amount = $items[17]; + $row->contract_payment_day = $items[18]; + $row->contract_money = $items[19]; + $row->refunds = $items[20]; + $row->refunds_comment = $items[21]; + $row->repayment_at = $items[22]; + $row->contact_guid = $items[23]; + $row->contact_shop_code = $items[24]; + $row->contract_cvs_class = $items[25]; + $row->contract_flag = $items[26]; + $row->settlement_transaction_id = $items[27]; + $row->contract_seal_issue = $items[28]; + $row->seal_reissue_request = $items[29]; + $row->contract_permission = $items[30]; + $row->contract_cancel_flag = $items[31]; + $row->tag_qr_flag = $items[32]; + $row->tag_change_flag = $items[33]; + $row->park_position = $items[34]; + $row->ope_id = $items[35]; + $row->contract_manual = $items[36]; + $row->contract_notice = $items[37]; + $row->contract_payment_number = $items[38]; + if (!$row->save()) { + $type = 0; + $msg = '行:record型が一致しません。'; + break; + } + } else { + $type = 0; + $msg = '行:record列数が一致しません。'; + break; + } + } + } catch (\Exception $e) { + dd($e); + $msg = '行:record型が一致しません。'; + $type = 0; + } + if ($type) { + DB::commit(); + return redirect()->route('regular_contracts')->with('success', __('輸入成功')); + } else { + DB::rollBack(); + return redirect()->route('regular_contracts')->with('error', __($msg, ['record' => $record])); + } + } else { + return redirect()->route('regular_contracts')->with('error', __('あなたはcsvファイルを選択していません。')); + } + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php new file mode 100644 index 0000000..54019a1 --- /dev/null +++ b/app/Http/Controllers/Admin/UserController.php @@ -0,0 +1,496 @@ + 0, + 'isExport' => $request->input('isExport', 0) * 1, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + 'page' => $request->get('page', 1), + 'user_id' => $request->input('user_id', ''), + 'member_id' => $request->input('member_id', ''), + 'user_tag_serial' => $request->input('user_tag_serial', ''), + 'user_phonetic' => $request->input('user_phonetic', ''), + 'phone' => $request->input('phone', ''), + 'crime' => $request->input('crime', ''), + 'black_list' => $request->input('black_list', ''), + 'ward_residents' => $request->input('ward_residents', ''), + 'user_tag_serial_64' => $request->input('user_tag_serial_64', ''), + 'photo_filename1' => $request->file('photo_filename1'), + 'photo_filename2' => $request->file('photo_filename2'), + ]; + $inputs['isMethodPost'] = $request->isMethod('post'); + $inputs['list'] = User::search($inputs); + if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) { + return redirect()->route('users'); + } + return view('admin.users.list', $inputs); + } + + public function add(Request $request) + { + $inputs = [ + 'user_id' => $request->input('user_id', ''), + 'member_id' => $request->input('member_id', ''), + 'user_pass' => $request->input('password', ''), + 'user_manual_regist_flag' => $request->input('user_manual_regist_flag', 0), + 'user_mailing_flag' => $request->input('user_mailing_flag', 0), + 'contract_number' => $request->input('contract_number', ''), + 'user_tag_serial' => $request->input('user_tag_serial', ''), + 'user_tag_serial_64' => $request->input('user_tag_serial_64', ''), + 'qr_code' => $request->input('qr_code', ''), + 'tag_qr_flag' => $request->input('tag_qr_flag', ''), + 'user_aid' => $request->input('user_aid', ''), + 'user_park_number' => $request->input('user_park_number', ''), + 'user_place_qrid' => $request->input('user_place_qrid', ''), + 'user_categoryid' => $request->input('user_categoryid', ''), + 'user_name' => $request->input('user_name', ''), + 'user_phonetic' => $request->input('user_phonetic', ''), + 'user_gender' => $request->input('user_gender', ''), + 'user_birthdate' => $request->input('user_birthdate', ''), + 'user_age' => $request->input('user_age', ''), + 'ward_residents' => $request->input('ward_residents', ''), + 'user_mobile' => $request->input('user_mobile', ''), + 'user_homephone' => $request->input('user_homephone', ''), + 'user_primemail' => $request->input('user_primemail', ''), + 'user_submail' => $request->input('user_submail', ''), + 'user_regident_zip' => $request->input('user_regident_zip', ''), + 'user_regident_pre' => $request->input('user_regident_pre', ''), + 'user_regident_city' => $request->input('user_regident_city', ''), + 'user_regident_add' => $request->input('user_regident_add', ''), + 'user_relate_zip' => $request->input('user_relate_zip', ''), + 'user_relate_pre' => $request->input('user_relate_pre', ''), + 'user_relate_city' => $request->input('user_relate_city', ''), + 'user_relate_add' => $request->input('user_relate_add', ''), + 'user_workplace' => $request->input('user_workplace', ''), + 'user_school' => $request->input('user_school', ''), + 'user_graduate' => $request->input('user_graduate', ''), + 'user_reduction' => $request->input('user_reduction', ''), + 'user_idcard' => $request->input('user_idcard', ''), + 'user_idcard_chk_flag' => $request->input('user_idcard_chk_flag', 0), + 'user_chk_day' => $request->input('user_chk_day', ''), + 'user_chk_opeid' => $request->input('user_chk_opeid', ''), + 'user_tag_issue' => $request->input('user_tag_issue', ''), + 'issue_permission' => $request->input('issue_permission', 0), + 'user_quit_flag' => $request->input('user_quit_flag', 0), + 'user_quitday' => $request->input('user_quitday', ''), + 'user_remarks' => $request->input('user_remarks', ''), + 'photo_filename1' => $request->file('photo_filename1'), + 'photo_filename2' => $request->file('photo_filename2'), + ]; + $dataList = $this->getDataDropList(); + $inputs = array_merge($inputs, $dataList); + + if ($request->isMethod('POST')) { + $type = false; + $validation = new UserRequest(); + $rules = $validation->rules(); + $rules['user_id'] = $rules['user_id'] . '|unique:user'; + $rules['password'] = 'required|min:6|confirmed'; + if(!empty($inputs['user_age']) ){ + $rules['user_age'] = 'integer'; + } + if(!empty($inputs['user_aid']) ){ + $rules['user_aid'] = 'integer'; + } + $validator = Validator::make($request->all(), $rules, $validation->messages()); + if (!$validator->fails()) { + if ($request->hasFile('photo_filename1') && $inputs['photo_filename1']->isValid()) { + $inputs['image1'] = Utils::uploadFile($inputs['photo_filename1']); + } else { + $inputs['image1'] = ''; + } + if ($request->hasFile('photo_filename2') && $inputs['photo_filename2']->isValid()) { + $inputs['image2'] = Utils::uploadFile($inputs['photo_filename2']); + } else { + $inputs['image2'] = ''; + } + \DB::transaction(function () use ($inputs, &$type) { + $new = new User(); + $new->fill($inputs); + if ($inputs['image1'] && $inputs['image1'] != '') { + $new->photo_filename2 = $inputs['image1']; + } + if ($inputs['image2'] && $inputs['image2'] != '') { + $new->photo_filename2 = $inputs['image2']; + } + if ($new->save()) { + $new->user_pass = Utils::getHashPassword($inputs['user_pass'], $new->user_seq); + $new->save(); + } + + $type = true; + }); + if ($type) { + $request->session()->flash('success', __('新しい成功を創造する。')); + return redirect()->route('users'); + } else { + $request->session()->flash('error', __('新しい作成に失敗しました')); + } + } else { + $inputs['errorMsg'] = $this->__buildErrorMessasges($validator); + $data['photo_filename1'] = ''; + $data['photo_filename2'] = ''; + } + } + + return view('admin.users.add', $inputs); + } + + public function edit(Request $request, $seq, $view = '') + { + $user = User::getUserBySeq($seq); + if (empty($seq) || empty($user)) { + abort('404'); + } + $data = $user->getAttributes(); + $filename1 = $data['photo_filename1']; + $filename2 = $data['photo_filename2']; + $dataList = $this->getDataDropList(); + $data = array_merge($data, $dataList); + + if ($request->isMethod('POST')) { + $type = false; + $validation = new UserRequest(); + $inputs = $request->all(); + $rules = $validation->rules(); + if (!empty($inputs['password'])) { + $rules['password'] = 'required|min:6|confirmed'; + } + if(!empty($inputs['user_age']) ){ + $rules['user_age'] = 'integer'; + } + if(!empty($inputs['user_aid']) ){ + $rules['user_aid'] = 'integer'; + } + $validator = Validator::make($inputs, $rules, $validation->messages()); + $data = array_merge($data, $inputs); + + if (!$validator->fails()) { + + if ($request->hasFile('photo_filename1') && $data['photo_filename1']->isValid()) { + $data['image1'] = Utils::uploadFile($data['photo_filename1']); + } else { + $data['image1'] = ''; + } + if ($request->hasFile('photo_filename2') && $data['photo_filename2']->isValid()) { + $data['image2'] = Utils::uploadFile($data['photo_filename2']); + } else { + $data['image2'] = ''; + } + \DB::transaction(function () use ($data, &$type, $user, $inputs) { + $user->fill($data); + if (!empty($inputs['password'])) { + $user->user_pass = Utils::getHashPassword($data['password'], $user->user_seq); + } + if ($data['image1'] && $data['image1'] != '') { + $user->photo_filename1 = $data['image1']; + } + if ($data['image2'] && $data['image2'] != '') { + $user->photo_filename2 = $data['image2']; + } + $user->save(); + $type = true; + }); + if ($type) { + $request->session()->flash('success', __('更新に成功しました')); + return redirect()->route('users'); + } else { + $request->session()->flash('error', __('更新に失敗しました')); + } + } else { + $data['errorMsg'] = $this->__buildErrorMessasges($validator); + $data['photo_filename1'] = $filename1; + $data['photo_filename2'] = $filename2; + + } + } + if ($view != '') { + return view($view, $data); + } + return view('admin.users.edit', $data); + } + + public function delete(Request $request) + { + $arr_seq = $request->get('seq'); + if ($arr_seq) { + if (User::deleteUsersBySeq($arr_seq)) { + return redirect()->route('users')->with('success', __("削除が完了しました。")); + } else { + return redirect()->route('users')->with('error', __('削除に失敗しました。')); + } + } + return redirect()->route('users')->with('error', __('削除するユーザーを選択してください。')); + } + + public function export(Request $request) + { + + $headers = array( + "Content-type" => "text/csv;charset=UTF-8", + 'Content-Encoding: UTF-8', + "Content-Disposition" => "attachment; filename=file.csv", + "Pragma" => "no-cache", + "Cache-Control" => "must-revalidate, post-check=0, pre-check=0", + "Expires" => "0" + ); + $inputs = [ + 'isMethodPost' => 0, + 'isExport' => 1, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + + ]; + + $dataExport = User::search($inputs); + $columns = array( + __('利用者連番'),// 0 + __('利用者ID'),// 1 + __('会員ID'),// 2 + __('パスワード'),// 3 + __('手動登録フラグ'),// 4 + __('手動登録フラグ'), + __('郵送必要フラグ'),// 5 + __('郵送必要フラグ'), + __('旧定期契約番号'),// 6 + __('タグシリアル'),// 7 + __('タグシリアル64進'),// 8 + __('QRコード'),// 9 + __('タグ/QRフラグ'),// 10 + __('タグ/QRフラグ'), + __('AID'),// 11 + __('居場所通知用QRID'),// 12 + __('利用者分類ID'),// 13 + __('利用者分類'), + __('利用者名'),// 14 + __('フリガナ'),// 15 + __('性別'),// 16 + __('生年月日'),// 17 + __('年齢'),// 18 + __('携帯電話番号'),// 19 + __('自宅電話番号'),// 20 + __('メールアドレス'),// 21 + __('予備メールアドレス'),// 22 + __('居住所:郵便番号'),// 23 + __('居住所:都道府県'),// 24 + __('居住所:市区群'),// 25 + __('居住所:住所'),// 26 + __('関連住所:郵便番号'),// 27 + __('関連住所:都道府県'),// 28 + __('関連住所:市区群'),// 29 + __('関連住所:住所'),// 30 + __('区民'),// 31 + __('勤務先名'),// 32 + __('学校'),// 33 + __('卒業予定'),// 34 + __('本人確認書類'),// 35 + __('本人確認チェック済'),// 36 + __('本人確認チェック済'), + __('本人確認日時'),// 37 + __('本人確認オペレータID'),// 38 + __('タグ発行数'),// 39 + __('タグ発行許可'),// 40 + __('退会フラグ'),// 41 + __('退会フラグ'), + __('退会日'),// 42 + __('備考'),// 43 + ); + $filename = "利用者マスタ.csv"; + $file = fopen($filename, 'w+'); + fputcsv($file, $columns); + foreach ($dataExport as $items) { + fputcsv($file, array( + $items->user_seq, // 0 + $items->user_id, // 1 + $items->member_id, // 2 + '',//TODO パスワード not found in database specs + $items->user_manual_regist_flag, // 4 + $items->user_manual_regist_flag ? __("はい") : __("いいえ"), + $items->user_mailing_flag, // 6 + $items->user_mailing_flag ? __("はい") : __("いいえ"), + $items->contract_number, // 8 + $items->user_tag_serial, // 9 + $items->user_tag_serial_64, // 10 + $items->qr_code, // 11 + $items->tag_qr_flag, // 12 + $items->tag_qr_flag ? __('QRコード') : __('タグ'), + $items->user_aid, // 14 + $items->user_place_qrid, // 15 + $items->user_categoryid, // 16 + $items->getUserType()->print_name, + $items->user_name, // 18 + $items->user_phonetic, // 19 + $items->user_gender, // 20 + $items->user_birthdate, // 21 + $items->user_age, // 22 + $items->user_mobile, // 23 + $items->user_homephone, // 24 + $items->user_primemail, // 25 + $items->user_submail, // 26 + $items->user_regident_zip, // 27 + $items->user_regident_pre, // 28 + $items->user_regident_city, // 29 + $items->user_regident_add, // 30 + $items->user_relate_zip, // 31 + $items->user_relate_pre, // 32 + $items->user_relate_city, // 33 + $items->user_relate_add, // 34 + $items->ward_residents, // 35 + $items->user_workplace, // 36 + $items->user_school, // 37 + $items->user_graduate, // 38 + $items->user_idcard, // 39 + $items->user_idcard_chk_flag, // 40 + \App\Models\User::USER_ID_CARD_CHK_FLG[$items->user_idcard_chk_flag], + $items->user_chk_day, // 42 + $items->user_chk_opeid, // 43 + $items->user_tag_issue, // 44 + $items->issue_permission, // 45 + $items->user_quit_flag, // 46 + $items->user_quit_flag ? __("はい") : __("いいえ"), + $items->user_quitday, // 48 + $items->user_remarks, // 49 + )); + } + fclose($file); + return Response::download($filename, $filename, $headers); + } + + public function import(Request $request) + { + $file = $request->file('file'); + if (!empty($file)) { + $data = Utils::csvToArray($file); + $type = 1; + $msg = ''; + $record = 0; + DB::beginTransaction(); + try { + User::query()->delete(); + $col = 50; + foreach ($data as $key => $items) { + $record = $key + 2; + if (count($items) == $col) { + $row = new User(); + $row->user_seq = $items[0]; + $row->user_id = $items[1]; + $row->member_id = $items[2]; + //TODO パスワード not found in database specs_$items[3] + $row->user_manual_regist_flag = $items[4]; + $row->user_mailing_flag = $items[6]; + $row->contract_number = $items[8]; + $row->user_tag_serial = $items[9]; + $row->user_tag_serial_64 = $items[10]; + $row->qr_code = $items[11]; + $row->tag_qr_flag = $items[12]; + $row->user_aid = $items[14]; + $row->user_place_qrid = $items[15]; + $row->user_categoryid = $items[16]; + $row->user_name = $items[18]; + $row->user_phonetic = $items[19]; + $row->user_gender = $items[20]; + $row->user_birthdate = $items[21]; + $row->user_age = !empty($items[22]) ? $items[22] : null; + $row->user_mobile = $items[23]; + $row->user_homephone = $items[24]; + $row->user_primemail = $items[25]; + $row->user_submail = $items[26]; + $row->user_regident_zip = $items[27]; + $row->user_regident_pre = $items[28]; + $row->user_regident_city = $items[29]; + $row->user_regident_add = $items[30]; + $row->user_relate_zip = $items[31]; + $row->user_relate_pre = $items[32]; + $row->user_relate_city = $items[33]; + $row->user_relate_add = $items[34]; + $row->ward_residents = $items[35]; + $row->user_workplace = $items[36]; + $row->user_school = $items[37]; + $row->user_graduate = $items[38]; + $row->user_idcard = $items[39]; + $row->user_idcard_chk_flag = $items[40]; + $row->user_chk_day = $items[42]; + $row->user_chk_opeid = $items[43]; + $row->user_tag_issue = $items[44]; + $row->issue_permission = $items[45]; + $row->user_quit_flag = $items[46]; + $row->user_quitday = $items[48]; + $row->user_remarks = $items[49]; + if (!$row->save()) { + $type = 0; + $msg = '行:record型が一致しません。'; + break; + } + } else { + $type = 0; + $msg = '行:record列数が一致しません。'; + break; + } + } + } catch (\Exception $e) { + $msg = '行:record型が一致しません。'; + $type = 0; + } + if ($type) { + DB::commit(); + return redirect()->route('users')->with('success', __('輸入成功')); + } else { + DB::rollBack(); + return redirect()->route('users')->with('error', __($msg, ['record' => $record])); + } + } else { + return redirect()->route('users')->with('error', __('あなたはcsvファイルを選択していません。')); + } + } + + + public function info(Request $request, $seq) + { + return $this->edit($request, $seq, 'admin.users.info'); + } + + public function getDataDropList() + { + $data['cities'] = City::getList(); + $data['listUserType'] = Usertype::getList(); + $data['listOpe'] = Ope::getList(); + return $data; + } + + /** + * バリデーションエラーメッセージを構築 + */ + private function __buildErrorMessasges($validator) + { + $messages = []; + foreach ($validator->errors()->all() as $message) { + $messages[] = $message; + } + return implode('
', $messages); + } + +} diff --git a/app/Http/Requests/RegularContractRequest.php b/app/Http/Requests/RegularContractRequest.php new file mode 100644 index 0000000..074598b --- /dev/null +++ b/app/Http/Requests/RegularContractRequest.php @@ -0,0 +1,38 @@ +'max:2', + 'contract_qr_id'=>'required', + 'user_id'=>'required|integer', + 'user_categoryid'=>'required|integer', + 'reserve_id'=>'required|integer', + 'park_id'=>'required|integer', + 'price_parkplaceid'=>'required|integer', + + + ]; + } +} \ No newline at end of file diff --git a/app/Http/Requests/UserRequest.php b/app/Http/Requests/UserRequest.php new file mode 100644 index 0000000..87cb195 --- /dev/null +++ b/app/Http/Requests/UserRequest.php @@ -0,0 +1,70 @@ + 'required|string|max:255', + 'user_name' => 'required|string|max:255', + 'user_phonetic' => 'nullable|string|max:255', + 'user_gender' => 'nullable|string', + 'user_birthdate' => 'nullable|date', + 'user_mobile' => 'nullable|string|max:20', + 'user_homephone' => 'nullable|string|max:20', + 'user_primemail' => 'nullable|email|max:255', + 'user_submail' => 'nullable|email|max:255', + 'user_regident_zip' => 'nullable|string|max:10', + 'user_regident_pre' => 'nullable|string|max:50', + 'user_regident_city' => 'nullable|string|max:100', + 'user_regident_add' => 'nullable|string|max:255', + 'user_relate_zip' => 'nullable|string|max:10', + 'user_relate_pre' => 'nullable|string|max:50', + 'user_relate_city' => 'nullable|string|max:100', + 'user_relate_add' => 'nullable|string|max:255', + 'user_workplace' => 'nullable|string|max:255', + 'user_school' => 'nullable|string|max:255', + 'user_graduate' => 'nullable|string|max:255', + 'user_idcard' => 'nullable|string|max:255', + 'user_remarks' => 'nullable|string', + 'photo_filename1' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048', + 'photo_filename2' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048', + ]; + } + + /** + * カスタムバリデーションメッセージ + */ + public function messages(): array + { + return [ + 'user_id.required' => '利用者IDは必須です。', + 'user_id.unique' => 'この利用者IDは既に使用されています。', + 'user_name.required' => '利用者名は必須です。', + 'user_primemail.email' => '有効なメールアドレスを入力してください。', + 'user_submail.email' => '有効なメールアドレスを入力してください。', + 'photo_filename1.image' => '写真ファイル1は画像である必要があります。', + 'photo_filename1.max' => '写真ファイル1のサイズは2MB以下である必要があります。', + 'photo_filename2.image' => '写真ファイル2は画像である必要があります。', + 'photo_filename2.max' => '写真ファイル2のサイズは2MB以下である必要があります。', + 'password.required' => 'パスワードは必須です。', + 'password.min' => 'パスワードは6文字以上である必要があります。', + 'password.confirmed' => 'パスワード確認が一致しません。', + ]; + } +} diff --git a/app/Models/City.php b/app/Models/City.php new file mode 100644 index 0000000..045f975 --- /dev/null +++ b/app/Models/City.php @@ -0,0 +1,24 @@ +get(); } else { - $list = $list->paginate(Utils::item_per_page); + $list = $list->paginate(\App\Utils::item_per_page); } return $list; diff --git a/app/Models/Park.php b/app/Models/Park.php index 7b0368e..58203e8 100644 --- a/app/Models/Park.php +++ b/app/Models/Park.php @@ -4,41 +4,84 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -/** - * 駐輪場モデル - parkテーブル(正式モデル) - * 旧UsingStatusParkの責務を置き換え - */ class Park extends Model { protected $table = 'park'; protected $primaryKey = 'park_id'; public $timestamps = true; - public const CREATED_AT = 'created_at'; - public const UPDATED_AT = 'updated_at'; - + /** + * The attributes that are mass assignable. + * + * @var list + */ protected $fillable = [ 'park_name', - 'park_ruby', - 'park_syllabary', - 'park_adrs', - 'park_close_flag', - 'park_day', - 'alert_flag', - 'print_number', - 'keep_alive', - 'city_id', - 'operator_id', + 'park_address', + 'park_phone', + 'park_description', + 'park_status', + 'park_capacity', + 'park_price', + 'park_operating_hours', ]; /** - * 料金設定との関連付け - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * 駐車場検索 */ - public function prices() + public static function search($inputs) { - return $this->hasMany(PriceA::class, 'park_id', 'park_id'); + $query = self::query(); + + // 検索条件の適用 + if (!empty($inputs['park_name'])) { + $query->where('park_name', 'like', '%' . $inputs['park_name'] . '%'); + } + if (!empty($inputs['park_address'])) { + $query->where('park_address', 'like', '%' . $inputs['park_address'] . '%'); + } + if (isset($inputs['park_status']) && $inputs['park_status'] !== '') { + $query->where('park_status', $inputs['park_status']); + } + + // ソート + if (!empty($inputs['sort'])) { + $sortType = !empty($inputs['sort_type']) ? $inputs['sort_type'] : 'asc'; + $query->orderBy($inputs['sort'], $sortType); + } else { + $query->orderBy('park_id', 'desc'); + } + + // エクスポート用の場合はページネーションしない + if (!empty($inputs['isExport'])) { + return $query->get(); + } + + // ページネーション(Utilsクラスの定数を使用) + return $query->paginate(\App\Utils::item_per_page); + } + + /** + * IDで駐車場を取得 + */ + public static function getParkById($id) + { + return self::find($id); + } + + /** + * 駐車場リストを取得(ドロップダウン用) + */ + public static function getList() + { + return self::pluck('park_name', 'park_id')->toArray(); + } + + /** + * 定期契約とのリレーション + */ + public function regularContracts() + { + return $this->hasMany(RegularContract::class, 'park_id', 'park_id'); } } - - diff --git a/app/Models/Pplace.php b/app/Models/Pplace.php new file mode 100644 index 0000000..32ac647 --- /dev/null +++ b/app/Models/Pplace.php @@ -0,0 +1,80 @@ +operator_id = Auth::user()->ope_id; + } + }); + } + * + /** + * 一覧検索・ソート処理 + */ + public static function search($inputs) + { + $list = self::query(); + + if ($inputs['isMethodPost'] ?? false) { + // ここで条件検索処理を追加可能(例: $list->where(...);) + } + + // 並び順 + if (!empty($inputs['sort'])) { + $list->orderBy($inputs['sort'], $inputs['sort_type'] ?? 'asc'); + } + + if ($inputs['isExport'] ?? false) { + return $list->get(); + } else { + return $list->paginate(Utils::item_per_page); + } + } + + /** + * 主キーで取得 + */ + public static function getByPk($pk) + { + return self::find($pk); + } + + /** + * 主キー配列で一括削除 + */ + public static function deleteByPk($arr) + { + return self::whereIn('pplace_id', $arr)->delete(); + } + + /** + * 選択リスト取得用(フォーム等) + */ + public static function getList() + { + return self::pluck('pplace_number', 'pplace_id'); + } +} diff --git a/app/Models/RegularContract.php b/app/Models/RegularContract.php index 93ffcbc..1c3f96c 100644 --- a/app/Models/RegularContract.php +++ b/app/Models/RegularContract.php @@ -4,18 +4,10 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -/** - * 定期契約モデル - regular_contractテーブル(正式モデル) - * 旧UsingStatusContractの責務を置き換え - */ class RegularContract extends Model { protected $table = 'regular_contract'; protected $primaryKey = 'contract_id'; - public $timestamps = true; - - public const CREATED_AT = 'created_at'; - public const UPDATED_AT = 'updated_at'; protected $fillable = [ 'contract_qr_id', @@ -33,8 +25,6 @@ class RegularContract extends Model 'contract_reduction', 'contract_periods', 'contract_periode', - 'enable_months', - 'printable_date', 'contract_taxid', 'billing_amount', 'contract_payment_day', @@ -49,10 +39,8 @@ class RegularContract extends Model 'settlement_transaction_id', 'contract_seal_issue', 'seal_reissue_request', - 'update_flag', 'contract_permission', 'contract_cancel_flag', - '800m_flag', 'tag_qr_flag', 'tag_change_flag', 'park_position', @@ -60,15 +48,61 @@ class RegularContract extends Model 'contract_manual', 'contract_notice', 'contract_payment_number', + 'created_at', + 'updated_at' ]; - /** - * 料金設定 - */ - public function price() + public static function search($inputs) { - return $this->belongsTo(PriceA::class, 'price_parkplaceid', 'price_parkplaceid'); + $list = self::query(); + // Sort + if ($inputs['sort']) { + $list->orderBy($inputs['sort'], $inputs['sort_type']); + } + if ($inputs['isExport']){ + $list = $list->get(); + }else{ + $list = $list->paginate(\App\Utils::item_per_page); // Utilsクラスの定数を使用 + } + return $list; } -} + public static function getByPk($pk) + { + return self::find($pk); + } + + public static function deleteByPk($arr) + { + return self::whereIn('contract_id', $arr)->delete(); + } + + //TODO 定期契約ID not found in database specs + //TODO 解約/契約不可フラグ not found in database specs + public function userName() + { + return $this->belongsTo(\App\Models\User::class,'user_id','user_seq')->first(); + } + public function getUserType() + { + return $this->belongsTo(\App\Models\Usertype::class,'user_categoryid','user_categoryid')->first(); + } + public function getPark() + { + return $this->belongsTo(\App\Models\Park::class,'park_id','park_id')->first(); + } + public function getPrice() + { + return $this->belongsTo(\App\Models\Price::class,'price_parkplaceid','price_parkplaceid')->first(); + } +// public function getSettlement() +// { +// return $this->belongsTo(SettlementTransaction::class,'settlement_transaction_id','settlement_transaction_id')->first(); +// } + + public function getOpe() + { + return $this->belongsTo(\App\Models\Ope::class,'ope_id','ope_id')->first(); + } +} \ No newline at end of file diff --git a/app/Models/User.php b/app/Models/User.php index 749c7b7..377b5fb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,25 +2,90 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Model; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Illuminate\Pagination\LengthAwarePaginator; -class User extends Authenticatable +class User extends Model { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory, Notifiable; + protected $table = 'user'; + protected $primaryKey = 'user_seq'; + public $timestamps = true; + + // 本人確認チェックフラグの定数 + const USER_ID_CARD_CHK_FLG = [ + 0 => '未確認', + 1 => '確認済み' + ]; + + // 身分証明書種別の定数 + const USER_IDCARD = [ + '運転免許証' => '運転免許証', + '健康保険証' => '健康保険証', + 'パスポート' => 'パスポート', + '学生証' => '学生証', + 'その他' => 'その他' + ]; + /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ - 'name', - 'email', - 'password', + 'user_id', + 'member_id', + 'user_pass', + 'user_manual_regist_flag', + 'user_mailing_flag', + 'contract_number', + 'user_tag_serial', + 'user_tag_serial_64', + 'qr_code', + 'tag_qr_flag', + 'user_aid', + 'user_park_number', + 'user_place_qrid', + 'user_categoryid', + 'user_name', + 'user_phonetic', + 'user_gender', + 'user_birthdate', + 'user_age', + 'ward_residents', + 'user_mobile', + 'user_homephone', + 'user_primemail', + 'user_submail', + 'user_regident_zip', + 'user_regident_pre', + 'user_regident_city', + 'user_regident_add', + 'user_relate_zip', + 'user_relate_pre', + 'user_relate_city', + 'user_relate_add', + 'user_workplace', + 'user_school', + 'user_graduate', + 'user_reduction', + 'user_idcard', + 'user_idcard_chk_flag', + 'user_chk_day', + 'user_chk_opeid', + 'user_tag_issue', + 'issue_permission', + 'user_quit_flag', + 'user_quitday', + 'user_remarks', + 'photo_filename1', + 'photo_filename2', ]; /** @@ -29,7 +94,7 @@ class User extends Authenticatable * @var list */ protected $hidden = [ - 'password', + 'user_pass', 'remember_token', ]; @@ -42,7 +107,106 @@ class User extends Authenticatable { return [ 'email_verified_at' => 'datetime', - 'password' => 'hashed', + 'user_birthdate' => 'date', + 'user_chk_day' => 'datetime', + 'user_quitday' => 'date', + 'user_manual_regist_flag' => 'boolean', + 'user_mailing_flag' => 'boolean', + 'tag_qr_flag' => 'boolean', + 'user_idcard_chk_flag' => 'boolean', + 'issue_permission' => 'boolean', + 'user_quit_flag' => 'boolean', ]; } + + /** + * ユーザー検索 + */ + public static function search($inputs) + { + $query = self::query(); + + // 検索条件の適用 + if (!empty($inputs['user_id'])) { + $query->where('user_id', 'like', '%' . $inputs['user_id'] . '%'); + } + if (!empty($inputs['member_id'])) { + $query->where('member_id', 'like', '%' . $inputs['member_id'] . '%'); + } + if (!empty($inputs['user_tag_serial'])) { + $query->where('user_tag_serial', 'like', '%' . $inputs['user_tag_serial'] . '%'); + } + if (!empty($inputs['user_phonetic'])) { + $query->where('user_phonetic', 'like', '%' . $inputs['user_phonetic'] . '%'); + } + if (!empty($inputs['phone'])) { + $query->where(function($q) use ($inputs) { + $q->where('user_mobile', 'like', '%' . $inputs['phone'] . '%') + ->orWhere('user_homephone', 'like', '%' . $inputs['phone'] . '%'); + }); + } + if (isset($inputs['black_list']) && $inputs['black_list'] !== '') { + $query->where('user_quit_flag', $inputs['black_list']); + } + if (isset($inputs['ward_residents']) && $inputs['ward_residents'] !== '') { + $query->where('ward_residents', $inputs['ward_residents']); + } + if (!empty($inputs['user_tag_serial_64'])) { + $query->where('user_tag_serial_64', 'like', '%' . $inputs['user_tag_serial_64'] . '%'); + } + + // ソート + if (!empty($inputs['sort'])) { + $sortType = !empty($inputs['sort_type']) ? $inputs['sort_type'] : 'asc'; + $query->orderBy($inputs['sort'], $sortType); + } else { + $query->orderBy('user_seq', 'desc'); + } + + // エクスポート用の場合はページネーションしない + if (!empty($inputs['isExport'])) { + return $query->get(); + } + + // ページネーション(Utilsクラスの定数を使用) + return $query->paginate(\App\Utils::item_per_page); + } + + /** + * シーケンスでユーザーを取得 + */ + public static function getUserBySeq($seq) + { + return self::where('user_seq', $seq)->first(); + } + + /** + * シーケンス配列でユーザーを削除 + */ + public static function deleteUsersBySeq($seqArray) + { + try { + return self::whereIn('user_seq', $seqArray)->delete(); + } catch (\Exception $e) { + return false; + } + } + + /** + * ユーザータイプとのリレーション + */ + public function getUserType() + { + return $this->belongsTo(Usertype::class, 'user_categoryid', 'id'); + } + + public static function getList() + { + return self::pluck('user_name', 'user_seq'); + } + + public static function getUserPhone() + { + return self::select('user_seq', 'user_name', 'user_mobile', 'user_homephone')->get(); + } } diff --git a/app/Models/Usertype.php b/app/Models/Usertype.php new file mode 100644 index 0000000..4f50f72 --- /dev/null +++ b/app/Models/Usertype.php @@ -0,0 +1,24 @@ + env('APP_LOCALE', 'en'), + 'locale' => env('APP_LOCALE', 'ja'), 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), diff --git a/public/assets/css/app.css b/public/assets/css/app.css new file mode 100644 index 0000000..6034345 --- /dev/null +++ b/public/assets/css/app.css @@ -0,0 +1,1100 @@ +/*! + * jquery-confirm v3.3.2 (http://craftpip.github.io/jquery-confirm/) + * Author: boniface pereira + * Website: www.craftpip.com + * Contact: hey@craftpip.com + * + * Copyright 2013-2017 jquery-confirm + * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) + */ +@-webkit-keyframes jconfirm-spin { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes jconfirm-spin { + from { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + to { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +body[class*=jconfirm-no-scroll-] { + overflow: hidden !important; +} +.jconfirm { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 99999999; + font-family: inherit; + overflow: hidden; +} +.jconfirm .jconfirm-bg { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + -webkit-transition: opacity .4s; + transition: opacity .4s; +} +.jconfirm .jconfirm-bg.jconfirm-bg-h { + opacity: 0 !important; +} +.jconfirm .jconfirm-scrollpane { + -webkit-perspective: 500px; + perspective: 500px; + -webkit-perspective-origin: center; + perspective-origin: center; + display: table; + width: 100%; + height: 100%; +} +.jconfirm .jconfirm-row { + display: table-row; + width: 100%; +} +.jconfirm .jconfirm-cell { + display: table-cell; + vertical-align: middle; +} +.jconfirm .jconfirm-holder { + max-height: 100%; + padding: 50px 0; +} +.jconfirm .jconfirm-box-container { + -webkit-transition: -webkit-transform; + transition: -webkit-transform; + transition: transform; + transition: transform, -webkit-transform; +} +.jconfirm .jconfirm-box-container.jconfirm-no-transition { + -webkit-transition: none !important; + transition: none !important; +} +.jconfirm .jconfirm-box { + background: white; + border-radius: 4px; + position: relative; + outline: none; + padding: 15px 15px 0; + overflow: hidden; + margin-left: auto; + margin-right: auto; +} +@-webkit-keyframes type-blue { + 1%, + 100% { + border-color: #3498db; + } + 50% { + border-color: #5faee3; + } +} +@keyframes type-blue { + 1%, + 100% { + border-color: #3498db; + } + 50% { + border-color: #5faee3; + } +} +@-webkit-keyframes type-green { + 1%, + 100% { + border-color: #2ecc71; + } + 50% { + border-color: #54d98c; + } +} +@keyframes type-green { + 1%, + 100% { + border-color: #2ecc71; + } + 50% { + border-color: #54d98c; + } +} +@-webkit-keyframes type-red { + 1%, + 100% { + border-color: #e74c3c; + } + 50% { + border-color: #ed7669; + } +} +@keyframes type-red { + 1%, + 100% { + border-color: #e74c3c; + } + 50% { + border-color: #ed7669; + } +} +@-webkit-keyframes type-orange { + 1%, + 100% { + border-color: #f1c40f; + } + 50% { + border-color: #f4d03f; + } +} +@keyframes type-orange { + 1%, + 100% { + border-color: #f1c40f; + } + 50% { + border-color: #f4d03f; + } +} +@-webkit-keyframes type-purple { + 1%, + 100% { + border-color: #9b59b6; + } + 50% { + border-color: #b07cc6; + } +} +@keyframes type-purple { + 1%, + 100% { + border-color: #9b59b6; + } + 50% { + border-color: #b07cc6; + } +} +@-webkit-keyframes type-dark { + 1%, + 100% { + border-color: #34495e; + } + 50% { + border-color: #46627f; + } +} +@keyframes type-dark { + 1%, + 100% { + border-color: #34495e; + } + 50% { + border-color: #46627f; + } +} +.jconfirm .jconfirm-box.jconfirm-type-animated { + -webkit-animation-duration: 2s; + animation-duration: 2s; + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; +} +.jconfirm .jconfirm-box.jconfirm-type-blue { + border-top: solid 7px #3498db; + -webkit-animation-name: type-blue; + animation-name: type-blue; +} +.jconfirm .jconfirm-box.jconfirm-type-green { + border-top: solid 7px #2ecc71; + -webkit-animation-name: type-green; + animation-name: type-green; +} +.jconfirm .jconfirm-box.jconfirm-type-red { + border-top: solid 7px #e74c3c; + -webkit-animation-name: type-red; + animation-name: type-red; +} +.jconfirm .jconfirm-box.jconfirm-type-orange { + border-top: solid 7px #f1c40f; + -webkit-animation-name: type-orange; + animation-name: type-orange; +} +.jconfirm .jconfirm-box.jconfirm-type-purple { + border-top: solid 7px #9b59b6; + -webkit-animation-name: type-purple; + animation-name: type-purple; +} +.jconfirm .jconfirm-box.jconfirm-type-dark { + border-top: solid 7px #34495e; + -webkit-animation-name: type-dark; + animation-name: type-dark; +} +.jconfirm .jconfirm-box.loading { + height: 120px; +} +.jconfirm .jconfirm-box.loading:before { + content: ''; + position: absolute; + left: 0; + background: white; + right: 0; + top: 0; + bottom: 0; + border-radius: 10px; + z-index: 1; +} +.jconfirm .jconfirm-box.loading:after { + opacity: 0.6; + content: ''; + height: 30px; + width: 30px; + border: solid 3px transparent; + position: absolute; + left: 50%; + margin-left: -15px; + border-radius: 50%; + -webkit-animation: jconfirm-spin 1s infinite linear; + animation: jconfirm-spin 1s infinite linear; + border-bottom-color: dodgerblue; + top: 50%; + margin-top: -15px; + z-index: 2; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon { + height: 20px; + width: 20px; + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; + opacity: .6; + text-align: center; + font-size: 27px !important; + line-height: 14px !important; + display: none; + z-index: 1; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon:empty { + display: none; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon .fa { + font-size: 16px; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon .glyphicon { + font-size: 16px; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon .zmdi { + font-size: 16px; +} +.jconfirm .jconfirm-box div.jconfirm-closeIcon:hover { + opacity: 1; +} +.jconfirm .jconfirm-box div.jconfirm-title-c { + display: block; + font-size: 22px; + line-height: 20px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: default; + padding-bottom: 15px; +} +.jconfirm .jconfirm-box div.jconfirm-title-c.jconfirm-hand { + cursor: move; +} +.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c { + font-size: inherit; + display: inline-block; + vertical-align: middle; +} +.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c i { + vertical-align: middle; +} +.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c:empty { + display: none; +} +.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + font-size: inherit; + font-family: inherit; + display: inline-block; + vertical-align: middle; +} +.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title:empty { + display: none; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane { + margin-bottom: 15px; + height: auto; + -webkit-transition: height 0.4s ease-in; + transition: height 0.4s ease-in; + display: inline-block; + width: 100%; + position: relative; + overflow-x: hidden; + overflow-y: auto; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane.no-scroll { + overflow-y: hidden; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar { + width: 3px; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar-track { + background: rgba(0, 0, 0, 0.1); +} +.jconfirm .jconfirm-box div.jconfirm-content-pane::-webkit-scrollbar-thumb { + background: #666; + border-radius: 3px; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content { + overflow: auto; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content img { + max-width: 100%; + height: auto; +} +.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content:empty { + display: none; +} +.jconfirm .jconfirm-box .jconfirm-buttons { + padding-bottom: 11px; +} +.jconfirm .jconfirm-box .jconfirm-buttons > button { + margin-bottom: 4px; + margin-left: 2px; + margin-right: 2px; +} +.jconfirm .jconfirm-box .jconfirm-buttons button { + display: inline-block; + padding: 6px 12px; + font-size: 14px; + font-weight: 400; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + border-radius: 4px; + min-height: 1em; + -webkit-transition: opacity 0.1s ease, background-color 0.1s ease, color 0.1s ease, background 0.1s ease, -webkit-box-shadow 0.1s ease; + transition: opacity 0.1s ease, background-color 0.1s ease, color 0.1s ease, background 0.1s ease, -webkit-box-shadow 0.1s ease; + transition: opacity 0.1s ease, background-color 0.1s ease, color 0.1s ease, box-shadow 0.1s ease, background 0.1s ease; + transition: opacity 0.1s ease, background-color 0.1s ease, color 0.1s ease, box-shadow 0.1s ease, background 0.1s ease, -webkit-box-shadow 0.1s ease; + -webkit-tap-highlight-color: transparent; + border: none; + background-image: none; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue { + background-color: #3498db; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue:hover { + background-color: #2980b9; + color: #FFF; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green { + background-color: #2ecc71; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green:hover { + background-color: #27ae60; + color: #FFF; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red { + background-color: #e74c3c; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red:hover { + background-color: #c0392b; + color: #FFF; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange { + background-color: #f1c40f; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange:hover { + background-color: #f39c12; + color: #FFF; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default { + background-color: #ecf0f1; + color: #000; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default:hover { + background-color: #bdc3c7; + color: #000; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple { + background-color: #9b59b6; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple:hover { + background-color: #8e44ad; + color: #FFF; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark { + background-color: #34495e; + color: #FFF; + text-shadow: none; + -webkit-transition: background .2s; + transition: background .2s; +} +.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark:hover { + background-color: #2c3e50; + color: #FFF; +} +.jconfirm .jconfirm-box.jconfirm-type-red .jconfirm-title-c .jconfirm-icon-c { + color: #e74c3c !important; +} +.jconfirm .jconfirm-box.jconfirm-type-blue .jconfirm-title-c .jconfirm-icon-c { + color: #3498db !important; +} +.jconfirm .jconfirm-box.jconfirm-type-green .jconfirm-title-c .jconfirm-icon-c { + color: #2ecc71 !important; +} +.jconfirm .jconfirm-box.jconfirm-type-purple .jconfirm-title-c .jconfirm-icon-c { + color: #9b59b6 !important; +} +.jconfirm .jconfirm-box.jconfirm-type-orange .jconfirm-title-c .jconfirm-icon-c { + color: #f1c40f !important; +} +.jconfirm .jconfirm-box.jconfirm-type-dark .jconfirm-title-c .jconfirm-icon-c { + color: #34495e !important; +} +.jconfirm .jconfirm-clear { + clear: both; +} +.jconfirm.jconfirm-rtl { + direction: rtl; +} +.jconfirm.jconfirm-rtl div.jconfirm-closeIcon { + left: 5px; + right: auto; +} +.jconfirm.jconfirm-white .jconfirm-bg, +.jconfirm.jconfirm-light .jconfirm-bg { + background-color: #444; + opacity: .2; +} +.jconfirm.jconfirm-white .jconfirm-box, +.jconfirm.jconfirm-light .jconfirm-box { + -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); + border-radius: 5px; +} +.jconfirm.jconfirm-white .jconfirm-box .jconfirm-title-c .jconfirm-icon-c, +.jconfirm.jconfirm-light .jconfirm-box .jconfirm-title-c .jconfirm-icon-c { + margin-right: 8px; + margin-left: 0px; +} +.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons, +.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons { + float: right; +} +.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button, +.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button { + text-transform: uppercase; + font-size: 14px; + font-weight: bold; + text-shadow: none; +} +.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default, +.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default { + -webkit-box-shadow: none; + box-shadow: none; + color: #333; +} +.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default:hover, +.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default:hover { + background: #ddd; +} +.jconfirm.jconfirm-white.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c, +.jconfirm.jconfirm-light.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c { + margin-left: 8px; + margin-right: 0px; +} +.jconfirm.jconfirm-black .jconfirm-bg, +.jconfirm.jconfirm-dark .jconfirm-bg { + background-color: darkslategray; + opacity: .4; +} +.jconfirm.jconfirm-black .jconfirm-box, +.jconfirm.jconfirm-dark .jconfirm-box { + -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); + background: #444; + border-radius: 5px; + color: white; +} +.jconfirm.jconfirm-black .jconfirm-box .jconfirm-title-c .jconfirm-icon-c, +.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-title-c .jconfirm-icon-c { + margin-right: 8px; + margin-left: 0px; +} +.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons, +.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons { + float: right; +} +.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button, +.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button { + border: none; + background-image: none; + text-transform: uppercase; + font-size: 14px; + font-weight: bold; + text-shadow: none; + -webkit-transition: background .1s; + transition: background .1s; + color: white; +} +.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default, +.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default { + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + background: none; +} +.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default:hover, +.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default:hover { + background: #666; +} +.jconfirm.jconfirm-black.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c, +.jconfirm.jconfirm-dark.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c { + margin-left: 8px; + margin-right: 0px; +} +.jconfirm .jconfirm-box.hilight.jconfirm-hilight-shake { + -webkit-animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; + animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +.jconfirm .jconfirm-box.hilight.jconfirm-hilight-glow { + -webkit-animation: glow 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; + animation: glow 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +@-webkit-keyframes shake { + 10%, + 90% { + -webkit-transform: translate3d(-2px, 0, 0); + transform: translate3d(-2px, 0, 0); + } + 20%, + 80% { + -webkit-transform: translate3d(4px, 0, 0); + transform: translate3d(4px, 0, 0); + } + 30%, + 50%, + 70% { + -webkit-transform: translate3d(-8px, 0, 0); + transform: translate3d(-8px, 0, 0); + } + 40%, + 60% { + -webkit-transform: translate3d(8px, 0, 0); + transform: translate3d(8px, 0, 0); + } +} +@keyframes shake { + 10%, + 90% { + -webkit-transform: translate3d(-2px, 0, 0); + transform: translate3d(-2px, 0, 0); + } + 20%, + 80% { + -webkit-transform: translate3d(4px, 0, 0); + transform: translate3d(4px, 0, 0); + } + 30%, + 50%, + 70% { + -webkit-transform: translate3d(-8px, 0, 0); + transform: translate3d(-8px, 0, 0); + } + 40%, + 60% { + -webkit-transform: translate3d(8px, 0, 0); + transform: translate3d(8px, 0, 0); + } +} +@-webkit-keyframes glow { + 0%, + 100% { + -webkit-box-shadow: 0 0 0px red; + box-shadow: 0 0 0px red; + } + 50% { + -webkit-box-shadow: 0 0 30px red; + box-shadow: 0 0 30px red; + } +} +@keyframes glow { + 0%, + 100% { + -webkit-box-shadow: 0 0 0px red; + box-shadow: 0 0 0px red; + } + 50% { + -webkit-box-shadow: 0 0 30px red; + box-shadow: 0 0 30px red; + } +} +/*Transition rules*/ +.jconfirm { + -webkit-perspective: 400px; + perspective: 400px; +} +.jconfirm .jconfirm-box { + opacity: 1; + -webkit-transition-property: all; + transition-property: all; +} +.jconfirm .jconfirm-box.jconfirm-animation-top, +.jconfirm .jconfirm-box.jconfirm-animation-left, +.jconfirm .jconfirm-box.jconfirm-animation-right, +.jconfirm .jconfirm-box.jconfirm-animation-bottom, +.jconfirm .jconfirm-box.jconfirm-animation-opacity, +.jconfirm .jconfirm-box.jconfirm-animation-zoom, +.jconfirm .jconfirm-box.jconfirm-animation-scale, +.jconfirm .jconfirm-box.jconfirm-animation-none, +.jconfirm .jconfirm-box.jconfirm-animation-rotate, +.jconfirm .jconfirm-box.jconfirm-animation-rotatex, +.jconfirm .jconfirm-box.jconfirm-animation-rotatey, +.jconfirm .jconfirm-box.jconfirm-animation-scaley, +.jconfirm .jconfirm-box.jconfirm-animation-scalex { + opacity: 0; +} +.jconfirm .jconfirm-box.jconfirm-animation-rotate { + -webkit-transform: rotate(90deg); + transform: rotate(90deg); +} +.jconfirm .jconfirm-box.jconfirm-animation-rotatex { + -webkit-transform: rotateX(90deg); + transform: rotateX(90deg); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-rotatexr { + -webkit-transform: rotateX(-90deg); + transform: rotateX(-90deg); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-rotatey { + -webkit-transform: rotatey(90deg); + transform: rotatey(90deg); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-rotateyr { + -webkit-transform: rotatey(-90deg); + transform: rotatey(-90deg); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-scaley { + -webkit-transform: scaley(1.5); + transform: scaley(1.5); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-scalex { + -webkit-transform: scalex(1.5); + transform: scalex(1.5); + -webkit-transform-origin: center; + transform-origin: center; +} +.jconfirm .jconfirm-box.jconfirm-animation-top { + -webkit-transform: translate(0px, -100px); + transform: translate(0px, -100px); +} +.jconfirm .jconfirm-box.jconfirm-animation-left { + -webkit-transform: translate(-100px, 0px); + transform: translate(-100px, 0px); +} +.jconfirm .jconfirm-box.jconfirm-animation-right { + -webkit-transform: translate(100px, 0px); + transform: translate(100px, 0px); +} +.jconfirm .jconfirm-box.jconfirm-animation-bottom { + -webkit-transform: translate(0px, 100px); + transform: translate(0px, 100px); +} +.jconfirm .jconfirm-box.jconfirm-animation-zoom { + -webkit-transform: scale(1.2); + transform: scale(1.2); +} +.jconfirm .jconfirm-box.jconfirm-animation-scale { + -webkit-transform: scale(0.5); + transform: scale(0.5); +} +.jconfirm .jconfirm-box.jconfirm-animation-none { + visibility: hidden; +} +.jconfirm.jconfirm-supervan .jconfirm-bg { + background-color: rgba(54, 70, 93, 0.95); +} +.jconfirm.jconfirm-supervan .jconfirm-box { + background-color: transparent; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-blue { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-green { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-red { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-orange { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-purple { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-dark { + border: none; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-closeIcon { + color: white; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c { + text-align: center; + color: white; + font-size: 28px; + font-weight: normal; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c > * { + padding-bottom: 25px; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c { + margin-right: 8px; + margin-left: 0px; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content-pane { + margin-bottom: 25px; +} +.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content { + text-align: center; + color: white; +} +.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons { + text-align: center; +} +.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons button { + font-size: 16px; + border-radius: 2px; + background: #303f53; + text-shadow: none; + border: none; + color: white; + padding: 10px; + min-width: 100px; +} +.jconfirm.jconfirm-supervan.jconfirm-rtl .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c { + margin-left: 8px; + margin-right: 0px; +} +.jconfirm.jconfirm-material .jconfirm-bg { + background-color: rgba(0, 0, 0, 0.67); +} +.jconfirm.jconfirm-material .jconfirm-box { + background-color: white; + -webkit-box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 13px 19px 2px rgba(0, 0, 0, 0.14), 0 5px 24px 4px rgba(0, 0, 0, 0.12); + box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 13px 19px 2px rgba(0, 0, 0, 0.14), 0 5px 24px 4px rgba(0, 0, 0, 0.12); + padding: 30px 25px 10px 25px; +} +.jconfirm.jconfirm-material .jconfirm-box .jconfirm-title-c .jconfirm-icon-c { + margin-right: 8px; + margin-left: 0px; +} +.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-closeIcon { + color: rgba(0, 0, 0, 0.87); +} +.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c { + color: rgba(0, 0, 0, 0.87); + font-size: 22px; + font-weight: bold; +} +.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-content { + color: rgba(0, 0, 0, 0.87); +} +.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons { + text-align: right; +} +.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons button { + text-transform: uppercase; + font-weight: 500; +} +.jconfirm.jconfirm-material.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c { + margin-left: 8px; + margin-right: 0px; +} +.jconfirm.jconfirm-bootstrap .jconfirm-bg { + background-color: rgba(0, 0, 0, 0.21); +} +.jconfirm.jconfirm-bootstrap .jconfirm-box { + background-color: white; + -webkit-box-shadow: 0 3px 8px 0px rgba(0, 0, 0, 0.2); + box-shadow: 0 3px 8px 0px rgba(0, 0, 0, 0.2); + border: solid 1px rgba(0, 0, 0, 0.4); + padding: 15px 0 0; +} +.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-title-c .jconfirm-icon-c { + margin-right: 8px; + margin-left: 0px; +} +.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-closeIcon { + color: rgba(0, 0, 0, 0.87); +} +.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-title-c { + color: rgba(0, 0, 0, 0.87); + font-size: 22px; + font-weight: bold; + padding-left: 15px; + padding-right: 15px; +} +.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-content { + color: rgba(0, 0, 0, 0.87); + padding: 0px 15px; +} +.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons { + text-align: right; + padding: 10px; + margin: -5px 0 0px; + border-top: solid 1px #ddd; + overflow: hidden; + border-radius: 0 0 4px 4px; +} +.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons button { + font-weight: 500; +} +.jconfirm.jconfirm-bootstrap.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c { + margin-left: 8px; + margin-right: 0px; +} +.jconfirm.jconfirm-modern .jconfirm-bg { + background-color: slategray; + opacity: .6; +} +.jconfirm.jconfirm-modern .jconfirm-box { + background-color: white; + -webkit-box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 13px 19px 2px rgba(0, 0, 0, 0.14), 0 5px 24px 4px rgba(0, 0, 0, 0.12); + box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 13px 19px 2px rgba(0, 0, 0, 0.14), 0 5px 24px 4px rgba(0, 0, 0, 0.12); + padding: 30px 30px 15px; +} +.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-closeIcon { + color: rgba(0, 0, 0, 0.87); + top: 15px; + right: 15px; +} +.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c { + color: rgba(0, 0, 0, 0.87); + font-size: 24px; + font-weight: bold; + text-align: center; + margin-bottom: 10px; +} +.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c { + -webkit-transition: -webkit-transform .5s; + transition: -webkit-transform .5s; + transition: transform .5s; + transition: transform .5s, -webkit-transform .5s; + -webkit-transform: scale(0); + transform: scale(0); + display: block; + margin-right: 0px; + margin-left: 0px; + margin-bottom: 10px; + font-size: 69px; + color: #aaa; +} +.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content { + text-align: center; + font-size: 15px; + color: #777; + margin-bottom: 25px; +} +.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons { + text-align: center; +} +.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button { + font-weight: bold; + text-transform: uppercase; + -webkit-transition: background .1s; + transition: background .1s; + padding: 10px 20px; +} +.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button + button { + margin-left: 4px; +} +.jconfirm.jconfirm-modern.jconfirm-open .jconfirm-box .jconfirm-title-c .jconfirm-icon-c { + -webkit-transform: scale(1); + transform: scale(1); +} +.login { + margin-top: 95px; +} + +.login .title { + font-size: 21px; + background: #FF9900; + height: 45px; + line-height: 45px; + margin-bottom: 50px; + font-weight: bold; +} + +.login .note { + margin-bottom: 35px; +} + +.page .row button { + margin-right: 20px; +} + +.scroll { + overflow: auto; +} + +.table th span, +.table td span { + white-space: nowrap; +} + +.table label { + margin: 0; +} + +.table td .btn_action { + display: inline-block; +} + +.error_input { + border: 1px solid #dc3545; + border-radius: 5px; +} + +.table_left { + padding-right: 0 !important; +} + +.table_left table thead th { + padding-left: 9px; +} + +.table_left table tr td { + padding: 9px; + background-color: #fff0dc; +} + +.table_right { + padding-left: 0 !important; +} + +.table_right table tr td { + height: 30px; +} + +table.dataTable thead .sorting:before, +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:before, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:before, +table.dataTable thead .sorting_desc_disabled:after { + bottom: 8px; +} + +.no_padding_right { + padding-right: 0 !important; +} + +.pagination { + margin: 0 !important; + float: right; +} + +.container-fluid.mb20 .btn { + height: 38px; +} + +a.btn.add_new { + line-height: 29px; +} + +@media (max-width: 576px) { + .table_left { + -webkit-box-flex: 0; + -ms-flex: 0 0 40%; + flex: 0 0 40%; + max-width: 40%; + } + + .table_right { + -webkit-box-flex: 0; + -ms-flex: 0 0 60%; + flex: 0 0 60%; + max-width: 60%; + } +} + +.form-group .required:after { + content: "*"; + color: red; +} + +.image { + width: 200px; + height: auto; +} + +.sorting span { + text-decoration: underline; + cursor: pointer; +} + diff --git a/public/index.php b/public/index.php index 4ab0d04..249163f 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,5 @@ ' + '' + '

!データをインポートします。既存のデータは全て削除します。継続してよろしいですか? はい/いいえ。

' + '
' + '' + '
' + '', + buttons: { + formSubmit: { + text: 'はい', + btnClass: 'btn-blue', + action: function action() { + $("#form_import").submit(); + } + }, + いいえ: function _() { + //close + } + } + }); +}); + +$('#export_csv').on('click', function () { + var _action = $(this).attr('action'), + user_id = $('#user_id').val(), + member_id = $('#member_id').val(), + user_tag_serial = $('#user_tag_serial').val(), + user_phonetic = $('#user_phonetic').val(), + phone = $('#phone').val(), + crime = $('#crime').val(), + sort = $('#sort').val(), + sort_type = $('#sort_type').val(); + $.confirm({ + title: '確認ダイアログ。', + content: '!CSVファイルを出力します。よろしいですか?はい/いいえ', + buttons: { + ok: { + text: "はい", + btnClass: 'btn-primary', + keys: ['enter'], + action: function action() { + window.location.href = _action + '?user_id=' + user_id + '&member_id=' + member_id + '&user_tag_serial=' + user_tag_serial + '&user_phonetic=' + user_phonetic + '&phone=' + phone + '&crime=' + crime + '&sort=' + sort + '&sort_type=' + sort_type + '&isExport=1'; + } + }, + いいえ: function _() {} + } + }); +}); + +// for sorting +$('.table thead th.sorting').on('click', function (e) { + var sort = $(this).attr('sort'); + var sort_type = 'asc'; + if ($(this).hasClass('sorting_asc')) { + sort_type = 'desc'; + } + $('input:hidden[name="sort"]').val(sort); + $('input:hidden[name="sort_type"]').val(sort_type); + $('form#list-form').submit(); +}); + +$('.date').datepicker({ + language: "ja", + format: "yyyy/mm/dd" +}); + +$('#select_user').on('change', function () { + var mobile = $('option:selected', this).attr('mobile'), + homePhone = $('option:selected', this).attr('homePhone'); + $('#mobile').val(mobile); + $('#homephone').val(homePhone); +}); +$('#select_user').trigger('change'); + +$('.register').on('click', function (e) { + e.preventDefault(); + $.confirm({ + title: '確認ダイアログ。', + content: '登録してよろしいですか?はい/いいえ', + buttons: { + ok: { + text: "はい", + btnClass: 'btn-primary', + keys: ['enter'], + action: function action() { + $("form").submit(); + } + }, + いいえ: function _() {} + } + }); +}); + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +/*! + * jquery-confirm v3.3.2 (http://craftpip.github.io/jquery-confirm/) + * Author: Boniface Pereira + * Website: www.craftpip.com + * Contact: hey@craftpip.com + * + * Copyright 2013-2017 jquery-confirm + * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) + */ + +if (typeof jQuery === 'undefined') { + throw new Error('jquery-confirm requires jQuery'); +} + +var jconfirm, Jconfirm; +(function ($, window) { + "use strict"; + + $.fn.confirm = function (options, option2) { + if (typeof options === 'undefined') options = {}; + if (typeof options === 'string') { + options = { + content: options, + title: (option2) ? option2 : false + }; + } + /* + * Alias of $.confirm to emulate native confirm() + */ + $(this).each(function () { + var $this = $(this); + if ($this.attr('jc-attached')) { + console.warn('jConfirm has already been attached to this element ', $this[0]); + return; + } + + $this.on('click', function (e) { + e.preventDefault(); + var jcOption = $.extend({}, options); + if ($this.attr('data-title')) + jcOption['title'] = $this.attr('data-title'); + if ($this.attr('data-content')) + jcOption['content'] = $this.attr('data-content'); + if (typeof jcOption['buttons'] == 'undefined') + jcOption['buttons'] = {}; + + jcOption['$target'] = $this; + if ($this.attr('href') && Object.keys(jcOption['buttons']).length == 0) { + var buttons = $.extend(true, {}, jconfirm.pluginDefaults.defaultButtons, (jconfirm.defaults || {}).defaultButtons || {}); + var firstBtn = Object.keys(buttons)[0]; + jcOption['buttons'] = buttons; + jcOption.buttons[firstBtn].action = function () { + location.href = $this.attr('href'); + }; + } + jcOption['closeIcon'] = false; + var instance = $.confirm(jcOption); + }); + + $this.attr('jc-attached', true); + }); + return $(this); + }; + $.confirm = function (options, option2) { + if (typeof options === 'undefined') options = {}; + if (typeof options === 'string') { + options = { + content: options, + title: (option2) ? option2 : false + }; + } + + var putDefaultButtons = !(options['buttons'] == false); + + if (typeof options['buttons'] != 'object') + options['buttons'] = {}; + + if (Object.keys(options['buttons']).length == 0 && putDefaultButtons) { + var buttons = $.extend(true, {}, jconfirm.pluginDefaults.defaultButtons, (jconfirm.defaults || {}).defaultButtons || {}); + options['buttons'] = buttons; + } + + /* + * Alias of jconfirm + */ + return jconfirm(options); + }; + $.alert = function (options, option2) { + if (typeof options === 'undefined') options = {}; + if (typeof options === 'string') { + options = { + content: options, + title: (option2) ? option2 : false + }; + } + + var putDefaultButtons = !(options['buttons'] == false); + + if (typeof options.buttons != 'object') + options.buttons = {}; + + if (Object.keys(options['buttons']).length == 0 && putDefaultButtons) { + var buttons = $.extend(true, {}, jconfirm.pluginDefaults.defaultButtons, (jconfirm.defaults || {}).defaultButtons || {}); + var firstBtn = Object.keys(buttons)[0]; + options['buttons'][firstBtn] = buttons[firstBtn]; + } + /* + * Alias of jconfirm + */ + return jconfirm(options); + }; + $.dialog = function (options, option2) { + if (typeof options === 'undefined') options = {}; + if (typeof options === 'string') { + options = { + content: options, + title: (option2) ? option2 : false, + closeIcon: function () { + // Just close the modal + } + }; + } + + options['buttons'] = {}; // purge buttons + + if (typeof options['closeIcon'] == 'undefined') { + // Dialog must have a closeIcon. + options['closeIcon'] = function () { + } + } + /* + * Alias of jconfirm + */ + options.confirmKeys = [13]; + return jconfirm(options); + }; + + jconfirm = function (options) { + if (typeof options === 'undefined') options = {}; + /* + * initial function for calling. + */ + var pluginOptions = $.extend(true, {}, jconfirm.pluginDefaults); + if (jconfirm.defaults) { + pluginOptions = $.extend(true, pluginOptions, jconfirm.defaults); + } + + /* + * merge options with plugin defaults. + */ + pluginOptions = $.extend(true, {}, pluginOptions, options); + var instance = new Jconfirm(pluginOptions); + jconfirm.instances.push(instance); + return instance; + }; + Jconfirm = function (options) { + /* + * constructor function Jconfirm, + * options = user options. + */ + $.extend(this, options); + this._init(); + }; + Jconfirm.prototype = { + _init: function () { + var that = this; + + if (!jconfirm.instances.length) + jconfirm.lastFocused = $('body').find(':focus'); + + this._id = Math.round(Math.random() * 99999); + /** + * contentParsed maintains the contents for $content, before it is put in DOM + */ + this.contentParsed = $(document.createElement('div')); + + if (!this.lazyOpen) { + setTimeout(function () { + that.open(); + }, 0); + } + }, + _buildHTML: function () { + var that = this; + + // prefix the animation string and store in animationParsed + this._parseAnimation(this.animation, 'o'); + this._parseAnimation(this.closeAnimation, 'c'); + this._parseBgDismissAnimation(this.backgroundDismissAnimation); + this._parseColumnClass(this.columnClass); + this._parseTheme(this.theme); + this._parseType(this.type); + + /* + * Append html. + */ + var template = $(this.template); + template.find('.jconfirm-box').addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed); + + if (this.typeAnimated) + template.find('.jconfirm-box').addClass('jconfirm-type-animated'); + + if (this.useBootstrap) { + template.find('.jc-bs3-row').addClass(this.bootstrapClasses.row); + template.find('.jc-bs3-row').addClass('justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center'); + + template.find('.jconfirm-box-container').addClass(this.columnClassParsed); + + if (this.containerFluid) + template.find('.jc-bs3-container').addClass(this.bootstrapClasses.containerFluid); + else + template.find('.jc-bs3-container').addClass(this.bootstrapClasses.container); + } else { + template.find('.jconfirm-box').css('width', this.boxWidth); + } + + if (this.titleClass) + template.find('.jconfirm-title-c').addClass(this.titleClass); + + template.addClass(this.themeParsed); + var ariaLabel = 'jconfirm-box' + this._id; + template.find('.jconfirm-box').attr('aria-labelledby', ariaLabel).attr('tabindex', -1); + template.find('.jconfirm-content').attr('id', ariaLabel); + if (this.bgOpacity !== null) + template.find('.jconfirm-bg').css('opacity', this.bgOpacity); + if (this.rtl) + template.addClass('jconfirm-rtl'); + + this.$el = template.appendTo(this.container); + this.$jconfirmBoxContainer = this.$el.find('.jconfirm-box-container'); + this.$jconfirmBox = this.$body = this.$el.find('.jconfirm-box'); + this.$jconfirmBg = this.$el.find('.jconfirm-bg'); + this.$title = this.$el.find('.jconfirm-title'); + this.$titleContainer = this.$el.find('.jconfirm-title-c'); + this.$content = this.$el.find('div.jconfirm-content'); + this.$contentPane = this.$el.find('.jconfirm-content-pane'); + this.$icon = this.$el.find('.jconfirm-icon-c'); + this.$closeIcon = this.$el.find('.jconfirm-closeIcon'); + this.$holder = this.$el.find('.jconfirm-holder'); + // this.$content.css(this._getCSS(this.animationSpeed, this.animationBounce)); + this.$btnc = this.$el.find('.jconfirm-buttons'); + this.$scrollPane = this.$el.find('.jconfirm-scrollpane'); + + that.setStartingPoint(); + + // for loading content via URL + this._contentReady = $.Deferred(); + this._modalReady = $.Deferred(); + this.$holder.css({ + 'padding-top': this.offsetTop, + 'padding-bottom': this.offsetBottom, + }); + + this.setTitle(); + this.setIcon(); + this._setButtons(); + this._parseContent(); + this.initDraggable(); + + if (this.isAjax) + this.showLoading(false); + + $.when(this._contentReady, this._modalReady).then(function () { + if (that.isAjaxLoading) + setTimeout(function () { + that.isAjaxLoading = false; + that.setContent(); + that.setTitle(); + that.setIcon(); + setTimeout(function () { + that.hideLoading(false); + that._updateContentMaxHeight(); + }, 100); + if (typeof that.onContentReady === 'function') + that.onContentReady(); + }, 50); + else { + // that.setContent(); + that._updateContentMaxHeight(); + that.setTitle(); + that.setIcon(); + if (typeof that.onContentReady === 'function') + that.onContentReady(); + } + + // start countdown after content has loaded. + if (that.autoClose) + that._startCountDown(); + }); + + this._watchContent(); + + if (this.animation === 'none') { + this.animationSpeed = 1; + this.animationBounce = 1; + } + + this.$body.css(this._getCSS(this.animationSpeed, this.animationBounce)); + this.$contentPane.css(this._getCSS(this.animationSpeed, 1)); + this.$jconfirmBg.css(this._getCSS(this.animationSpeed, 1)); + this.$jconfirmBoxContainer.css(this._getCSS(this.animationSpeed, 1)); + }, + _typePrefix: 'jconfirm-type-', + typeParsed: '', + _parseType: function (type) { + this.typeParsed = this._typePrefix + type; + }, + setType: function (type) { + var oldClass = this.typeParsed; + this._parseType(type); + this.$jconfirmBox.removeClass(oldClass).addClass(this.typeParsed); + }, + themeParsed: '', + _themePrefix: 'jconfirm-', + setTheme: function (theme) { + var previous = this.theme; + this.theme = theme || this.theme; + this._parseTheme(this.theme); + if (previous) + this.$el.removeClass(previous); + this.$el.addClass(this.themeParsed); + this.theme = theme; + }, + _parseTheme: function (theme) { + var that = this; + theme = theme.split(','); + $.each(theme, function (k, a) { + if (a.indexOf(that._themePrefix) === -1) + theme[k] = that._themePrefix + $.trim(a); + }); + this.themeParsed = theme.join(' ').toLowerCase(); + }, + backgroundDismissAnimationParsed: '', + _bgDismissPrefix: 'jconfirm-hilight-', + _parseBgDismissAnimation: function (bgDismissAnimation) { + var animation = bgDismissAnimation.split(','); + var that = this; + $.each(animation, function (k, a) { + if (a.indexOf(that._bgDismissPrefix) === -1) + animation[k] = that._bgDismissPrefix + $.trim(a); + }); + this.backgroundDismissAnimationParsed = animation.join(' ').toLowerCase(); + }, + animationParsed: '', + closeAnimationParsed: '', + _animationPrefix: 'jconfirm-animation-', + setAnimation: function (animation) { + this.animation = animation || this.animation; + this._parseAnimation(this.animation, 'o'); + }, + _parseAnimation: function (animation, which) { + which = which || 'o'; // parse what animation and store where. open or close? + var animations = animation.split(','); + var that = this; + $.each(animations, function (k, a) { + if (a.indexOf(that._animationPrefix) === -1) + animations[k] = that._animationPrefix + $.trim(a); + }); + var a_string = animations.join(' ').toLowerCase(); + if (which === 'o') + this.animationParsed = a_string; + else + this.closeAnimationParsed = a_string; + + return a_string; + }, + setCloseAnimation: function (closeAnimation) { + this.closeAnimation = closeAnimation || this.closeAnimation; + this._parseAnimation(this.closeAnimation, 'c'); + }, + setAnimationSpeed: function (speed) { + this.animationSpeed = speed || this.animationSpeed; + // this.$body.css(this._getCSS(this.animationSpeed, this.animationBounce)); + }, + columnClassParsed: '', + setColumnClass: function (colClass) { + if (!this.useBootstrap) { + console.warn("cannot set columnClass, useBootstrap is set to false"); + return; + } + this.columnClass = colClass || this.columnClass; + this._parseColumnClass(this.columnClass); + this.$jconfirmBoxContainer.addClass(this.columnClassParsed); + }, + _updateContentMaxHeight: function () { + var height = $(window).height() - (this.$jconfirmBox.outerHeight() - this.$contentPane.outerHeight()) - (this.offsetTop + this.offsetBottom); + this.$contentPane.css({ + 'max-height': height + 'px' + }); + }, + setBoxWidth: function (width) { + if (this.useBootstrap) { + console.warn("cannot set boxWidth, useBootstrap is set to true"); + return; + } + this.boxWidth = width; + this.$jconfirmBox.css('width', width); + }, + _parseColumnClass: function (colClass) { + colClass = colClass.toLowerCase(); + var p; + switch (colClass) { + case 'xl': + case 'xlarge': + p = 'col-md-12'; + break; + case 'l': + case 'large': + p = 'col-md-8 col-md-offset-2'; + break; + case 'm': + case 'medium': + p = 'col-md-6 col-md-offset-3'; + break; + case 's': + case 'small': + p = 'col-md-4 col-md-offset-4'; + break; + case 'xs': + case 'xsmall': + p = 'col-md-2 col-md-offset-5'; + break; + default: + p = colClass; + } + this.columnClassParsed = p; + }, + initDraggable: function () { + var that = this; + var $t = this.$titleContainer; + + this.resetDrag(); + if (this.draggable) { + $t.on('mousedown', function (e) { + $t.addClass('jconfirm-hand'); + that.mouseX = e.clientX; + that.mouseY = e.clientY; + that.isDrag = true; + }); + $(window).on('mousemove.' + this._id, function (e) { + if (that.isDrag) { + that.movingX = e.clientX - that.mouseX + that.initialX; + that.movingY = e.clientY - that.mouseY + that.initialY; + that.setDrag(); + } + }); + + $(window).on('mouseup.' + this._id, function () { + $t.removeClass('jconfirm-hand'); + if (that.isDrag) { + that.isDrag = false; + that.initialX = that.movingX; + that.initialY = that.movingY; + } + }) + } + }, + resetDrag: function () { + this.isDrag = false; + this.initialX = 0; + this.initialY = 0; + this.movingX = 0; + this.movingY = 0; + this.mouseX = 0; + this.mouseY = 0; + this.$jconfirmBoxContainer.css('transform', 'translate(' + 0 + 'px, ' + 0 + 'px)'); + }, + setDrag: function () { + if (!this.draggable) + return; + + this.alignMiddle = false; + var boxWidth = this.$jconfirmBox.outerWidth(); + var boxHeight = this.$jconfirmBox.outerHeight(); + var windowWidth = $(window).width(); + var windowHeight = $(window).height(); + var that = this; + var dragUpdate = 1; + if (that.movingX % dragUpdate === 0 || that.movingY % dragUpdate === 0) { + if (that.dragWindowBorder) { + var leftDistance = (windowWidth / 2) - boxWidth / 2; + var topDistance = (windowHeight / 2) - boxHeight / 2; + topDistance -= that.dragWindowGap; + leftDistance -= that.dragWindowGap; + + if (leftDistance + that.movingX < 0) { + that.movingX = -leftDistance; + } else if (leftDistance - that.movingX < 0) { + that.movingX = leftDistance; + } + + if (topDistance + that.movingY < 0) { + that.movingY = -topDistance; + } else if (topDistance - that.movingY < 0) { + that.movingY = topDistance; + } + } + + that.$jconfirmBoxContainer.css('transform', 'translate(' + that.movingX + 'px, ' + that.movingY + 'px)'); + } + }, + _scrollTop: function () { + if (typeof pageYOffset !== 'undefined') { + //most browsers except IE before #9 + return pageYOffset; + } + else { + var B = document.body; //IE 'quirks' + var D = document.documentElement; //IE with doctype + D = (D.clientHeight) ? D : B; + return D.scrollTop; + } + }, + _watchContent: function () { + var that = this; + if (this._timer) clearInterval(this._timer); + + var prevContentHeight = 0; + this._timer = setInterval(function () { + if (that.smoothContent) { + var contentHeight = that.$content.outerHeight() || 0; + if (contentHeight !== prevContentHeight) { + that.$contentPane.css({ + 'height': contentHeight + }).scrollTop(0); + prevContentHeight = contentHeight; + } + var wh = $(window).height(); + var total = that.offsetTop + that.offsetBottom + that.$jconfirmBox.height() - that.$contentPane.height() + that.$content.height(); + if (total < wh) { + that.$contentPane.addClass('no-scroll'); + } else { + that.$contentPane.removeClass('no-scroll'); + } + } + }, this.watchInterval); + }, + _overflowClass: 'jconfirm-overflow', + _hilightAnimating: false, + highlight: function () { + this.hiLightModal(); + }, + hiLightModal: function () { + var that = this; + if (this._hilightAnimating) + return; + + that.$body.addClass('hilight'); + var duration = parseFloat(that.$body.css('animation-duration')) || 2; + this._hilightAnimating = true; + setTimeout(function () { + that._hilightAnimating = false; + that.$body.removeClass('hilight'); + }, duration * 1000); + }, + _bindEvents: function () { + var that = this; + this.boxClicked = false; + + this.$scrollPane.click(function (e) { // Ignore propagated clicks + if (!that.boxClicked) { // Background clicked + /* + If backgroundDismiss is a function and its return value is truthy + proceed to close the modal. + */ + var buttonName = false; + var shouldClose = false; + var str; + + if (typeof that.backgroundDismiss == 'function') + str = that.backgroundDismiss(); + else + str = that.backgroundDismiss; + + if (typeof str == 'string' && typeof that.buttons[str] != 'undefined') { + buttonName = str; + shouldClose = false; + } else if (typeof str == 'undefined' || !!(str) == true) { + shouldClose = true; + } else { + shouldClose = false; + } + + if (buttonName) { + var btnResponse = that.buttons[buttonName].action.apply(that); + shouldClose = (typeof btnResponse == 'undefined') || !!(btnResponse); + } + + if (shouldClose) + that.close(); + else + that.hiLightModal(); + } + that.boxClicked = false; + }); + + this.$jconfirmBox.click(function (e) { + that.boxClicked = true; + }); + + var isKeyDown = false; + $(window).on('jcKeyDown.' + that._id, function (e) { + if (!isKeyDown) { + isKeyDown = true; + } + }); + $(window).on('keyup.' + that._id, function (e) { + if (isKeyDown) { + that.reactOnKey(e); + isKeyDown = false; + } + }); + + $(window).on('resize.' + this._id, function () { + that._updateContentMaxHeight(); + setTimeout(function () { + that.resetDrag(); + }, 100); + }); + }, + _cubic_bezier: '0.36, 0.55, 0.19', + _getCSS: function (speed, bounce) { + return { + '-webkit-transition-duration': speed / 1000 + 's', + 'transition-duration': speed / 1000 + 's', + '-webkit-transition-timing-function': 'cubic-bezier(' + this._cubic_bezier + ', ' + bounce + ')', + 'transition-timing-function': 'cubic-bezier(' + this._cubic_bezier + ', ' + bounce + ')' + }; + }, + _setButtons: function () { + var that = this; + /* + * Settings up buttons + */ + + var total_buttons = 0; + if (typeof this.buttons !== 'object') + this.buttons = {}; + + $.each(this.buttons, function (key, button) { + total_buttons += 1; + if (typeof button === 'function') { + that.buttons[key] = button = { + action: button + }; + } + + that.buttons[key].text = button.text || key; + that.buttons[key].btnClass = button.btnClass || 'btn-default'; + that.buttons[key].action = button.action || function () { + }; + that.buttons[key].keys = button.keys || []; + that.buttons[key].isHidden = button.isHidden || false; + that.buttons[key].isDisabled = button.isDisabled || false; + + $.each(that.buttons[key].keys, function (i, a) { + that.buttons[key].keys[i] = a.toLowerCase(); + }); + + var button_element = $('') + .html(that.buttons[key].text) + .addClass(that.buttons[key].btnClass) + .prop('disabled', that.buttons[key].isDisabled) + .css('display', that.buttons[key].isHidden ? 'none' : '') + .click(function (e) { + e.preventDefault(); + var res = that.buttons[key].action.apply(that, [that.buttons[key]]); + that.onAction.apply(that, [key, that.buttons[key]]); + that._stopCountDown(); + if (typeof res === 'undefined' || res) + that.close(); + }); + + that.buttons[key].el = button_element; + that.buttons[key].setText = function (text) { + button_element.html(text); + }; + that.buttons[key].addClass = function (className) { + button_element.addClass(className); + }; + that.buttons[key].removeClass = function (className) { + button_element.removeClass(className); + }; + that.buttons[key].disable = function () { + that.buttons[key].isDisabled = true; + button_element.prop('disabled', true); + }; + that.buttons[key].enable = function () { + that.buttons[key].isDisabled = false; + button_element.prop('disabled', false); + }; + that.buttons[key].show = function () { + that.buttons[key].isHidden = false; + button_element.css('display', ''); + }; + that.buttons[key].hide = function () { + that.buttons[key].isHidden = true; + button_element.css('display', 'none'); + }; + /* + Buttons are prefixed with $_ or $$ for quick access + */ + that['$_' + key] = that['$$' + key] = button_element; + that.$btnc.append(button_element); + }); + + if (total_buttons === 0) this.$btnc.hide(); + if (this.closeIcon === null && total_buttons === 0) { + /* + in case when no buttons are present & closeIcon is null, closeIcon is set to true, + set closeIcon to true to explicitly tell to hide the close icon + */ + this.closeIcon = true; + } + + if (this.closeIcon) { + if (this.closeIconClass) { + // user requires a custom class. + var closeHtml = ''; + this.$closeIcon.html(closeHtml); + } + + this.$closeIcon.click(function (e) { + e.preventDefault(); + + var buttonName = false; + var shouldClose = false; + var str; + + if (typeof that.closeIcon == 'function') { + str = that.closeIcon(); + } else { + str = that.closeIcon; + } + + if (typeof str == 'string' && typeof that.buttons[str] != 'undefined') { + buttonName = str; + shouldClose = false; + } else if (typeof str == 'undefined' || !!(str) == true) { + shouldClose = true; + } else { + shouldClose = false; + } + if (buttonName) { + var btnResponse = that.buttons[buttonName].action.apply(that); + shouldClose = (typeof btnResponse == 'undefined') || !!(btnResponse); + } + if (shouldClose) { + that.close(); + } + }); + this.$closeIcon.show(); + } else { + this.$closeIcon.hide(); + } + }, + setTitle: function (string, force) { + force = force || false; + + if (typeof string !== 'undefined') + if (typeof string == 'string') + this.title = string; + else if (typeof string == 'function') { + if (typeof string.promise == 'function') + console.error('Promise was returned from title function, this is not supported.'); + + var response = string(); + if (typeof response == 'string') + this.title = response; + else + this.title = false; + } else + this.title = false; + + if (this.isAjaxLoading && !force) + return; + + this.$title.html(this.title || ''); + this.updateTitleContainer(); + }, + setIcon: function (iconClass, force) { + force = force || false; + + if (typeof iconClass !== 'undefined') + if (typeof iconClass == 'string') + this.icon = iconClass; + else if (typeof iconClass === 'function') { + var response = iconClass(); + if (typeof response == 'string') + this.icon = response; + else + this.icon = false; + } + else + this.icon = false; + + if (this.isAjaxLoading && !force) + return; + + this.$icon.html(this.icon ? '' : ''); + this.updateTitleContainer(); + }, + updateTitleContainer: function () { + if (!this.title && !this.icon) { + this.$titleContainer.hide(); + } else { + this.$titleContainer.show(); + } + }, + setContentPrepend: function (content, force) { + if (!content) + return; + + this.contentParsed.prepend(content); + }, + setContentAppend: function (content) { + if (!content) + return; + + this.contentParsed.append(content); + }, + setContent: function (content, force) { + force = !!force; + var that = this; + if (content) + this.contentParsed.html('').append(content); + if (this.isAjaxLoading && !force) + return; + + this.$content.html(''); + this.$content.append(this.contentParsed); + setTimeout(function () { + that.$body.find('input[autofocus]:visible:first').focus(); + }, 100); + }, + loadingSpinner: false, + showLoading: function (disableButtons) { + this.loadingSpinner = true; + this.$jconfirmBox.addClass('loading'); + if (disableButtons) + this.$btnc.find('button').prop('disabled', true); + + }, + hideLoading: function (enableButtons) { + this.loadingSpinner = false; + this.$jconfirmBox.removeClass('loading'); + if (enableButtons) + this.$btnc.find('button').prop('disabled', false); + + }, + ajaxResponse: false, + contentParsed: '', + isAjax: false, + isAjaxLoading: false, + _parseContent: function () { + var that = this; + var e = ' '; + + if (typeof this.content == 'function') { + var res = this.content.apply(this); + if (typeof res == 'string') { + this.content = res; + } + else if (typeof res == 'object' && typeof res.always == 'function') { + // this is ajax loading via promise + this.isAjax = true; + this.isAjaxLoading = true; + res.always(function (data, status, xhr) { + that.ajaxResponse = { + data: data, + status: status, + xhr: xhr + }; + that._contentReady.resolve(data, status, xhr); + if (typeof that.contentLoaded == 'function') + that.contentLoaded(data, status, xhr); + }); + this.content = e; + } else { + this.content = e; + } + } + + if (typeof this.content == 'string' && this.content.substr(0, 4).toLowerCase() === 'url:') { + this.isAjax = true; + this.isAjaxLoading = true; + var u = this.content.substring(4, this.content.length); + $.get(u).done(function (html) { + that.contentParsed.html(html); + }).always(function (data, status, xhr) { + that.ajaxResponse = { + data: data, + status: status, + xhr: xhr + }; + that._contentReady.resolve(data, status, xhr); + if (typeof that.contentLoaded == 'function') + that.contentLoaded(data, status, xhr); + }); + } + + if (!this.content) + this.content = e; + + if (!this.isAjax) { + this.contentParsed.html(this.content); + this.setContent(); + that._contentReady.resolve(); + } + }, + _stopCountDown: function () { + clearInterval(this.autoCloseInterval); + if (this.$cd) + this.$cd.remove(); + }, + _startCountDown: function () { + var that = this; + var opt = this.autoClose.split('|'); + if (opt.length !== 2) { + console.error('Invalid option for autoClose. example \'close|10000\''); + return false; + } + + var button_key = opt[0]; + var time = parseInt(opt[1]); + if (typeof this.buttons[button_key] === 'undefined') { + console.error('Invalid button key \'' + button_key + '\' for autoClose'); + return false; + } + + var seconds = Math.ceil(time / 1000); + this.$cd = $(' (' + seconds + ')') + .appendTo(this['$_' + button_key]); + + this.autoCloseInterval = setInterval(function () { + that.$cd.html(' (' + (seconds -= 1) + ') '); + if (seconds <= 0) { + that['$$' + button_key].trigger('click'); + that._stopCountDown(); + } + }, 1000); + }, + _getKey: function (key) { + // very necessary keys. + switch (key) { + case 192: + return 'tilde'; + case 13: + return 'enter'; + case 16: + return 'shift'; + case 9: + return 'tab'; + case 20: + return 'capslock'; + case 17: + return 'ctrl'; + case 91: + return 'win'; + case 18: + return 'alt'; + case 27: + return 'esc'; + case 32: + return 'space'; + } + + // only trust alphabets with this. + var initial = String.fromCharCode(key); + if (/^[A-z0-9]+$/.test(initial)) + return initial.toLowerCase(); + else + return false; + }, + reactOnKey: function (e) { + var that = this; + + /* + Prevent keyup event if the dialog is not last! + */ + var a = $('.jconfirm'); + if (a.eq(a.length - 1)[0] !== this.$el[0]) + return false; + + var key = e.which; + /* + Do not react if Enter or Space is pressed on input elements + */ + if (this.$content.find(':input').is(':focus') && /13|32/.test(key)) + return false; + + var keyChar = this._getKey(key); + + // If esc is pressed + if (keyChar === 'esc' && this.escapeKey) { + if (this.escapeKey === true) { + this.$scrollPane.trigger('click'); + } + else if (typeof this.escapeKey === 'string' || typeof this.escapeKey === 'function') { + var buttonKey; + if (typeof this.escapeKey === 'function') { + buttonKey = this.escapeKey(); + } else { + buttonKey = this.escapeKey; + } + + if (buttonKey) + if (typeof this.buttons[buttonKey] === 'undefined') { + console.warn('Invalid escapeKey, no buttons found with key ' + buttonKey); + } else { + this['$_' + buttonKey].trigger('click'); + } + } + } + + // check if any button is listening to this key. + $.each(this.buttons, function (key, button) { + if (button.keys.indexOf(keyChar) != -1) { + that['$_' + key].trigger('click'); + } + }); + }, + setDialogCenter: function () { + console.info('setDialogCenter is deprecated, dialogs are centered with CSS3 tables'); + }, + _unwatchContent: function () { + clearInterval(this._timer); + }, + close: function (onClosePayload) { + var that = this; + + if (typeof this.onClose === 'function') + this.onClose(onClosePayload); + + this._unwatchContent(); + + /* + unbind the window resize & keyup event. + */ + $(window).unbind('resize.' + this._id); + $(window).unbind('keyup.' + this._id); + $(window).unbind('jcKeyDown.' + this._id); + + if (this.draggable) { + $(window).unbind('mousemove.' + this._id); + $(window).unbind('mouseup.' + this._id); + this.$titleContainer.unbind('mousedown'); + } + + that.$el.removeClass(that.loadedClass); + $('body').removeClass('jconfirm-no-scroll-' + that._id); + that.$jconfirmBoxContainer.removeClass('jconfirm-no-transition'); + + setTimeout(function () { + that.$body.addClass(that.closeAnimationParsed); + that.$jconfirmBg.addClass('jconfirm-bg-h'); + var closeTimer = (that.closeAnimation === 'none') ? 1 : that.animationSpeed; + + setTimeout(function () { + that.$el.remove(); + + var l = jconfirm.instances; + var i = jconfirm.instances.length - 1; + for (i; i >= 0; i--) { + if (jconfirm.instances[i]._id === that._id) { + jconfirm.instances.splice(i, 1); + } + } + + // Focusing a element, scrolls automatically to that element. + // no instances should be open, lastFocused should be true, the lastFocused element must exists in DOM + if (!jconfirm.instances.length) { + if (that.scrollToPreviousElement && jconfirm.lastFocused && jconfirm.lastFocused.length && $.contains(document, jconfirm.lastFocused[0])) { + var $lf = jconfirm.lastFocused; + if (that.scrollToPreviousElementAnimate) { + var st = $(window).scrollTop(); + var ot = jconfirm.lastFocused.offset().top; + var wh = $(window).height(); + if (!(ot > st && ot < (st + wh))) { + var scrollTo = (ot - Math.round((wh / 3))); + $('html, body').animate({ + scrollTop: scrollTo + }, that.animationSpeed, 'swing', function () { + // gracefully scroll and then focus. + $lf.focus(); + }); + } else { + // the element to be focused is already in view. + $lf.focus(); + } + } else { + $lf.focus(); + } + jconfirm.lastFocused = false; + } + } + + if (typeof that.onDestroy === 'function') + that.onDestroy(); + + }, closeTimer * 0.40); + }, 50); + + return true; + }, + open: function () { + if (this.isOpen()) + return false; + + // var that = this; + this._buildHTML(); + this._bindEvents(); + this._open(); + + return true; + }, + setStartingPoint: function () { + var el = false; + + if (this.animateFromElement !== true && this.animateFromElement) { + el = this.animateFromElement; + jconfirm.lastClicked = false; + } else if (jconfirm.lastClicked && this.animateFromElement === true) { + el = jconfirm.lastClicked; + jconfirm.lastClicked = false; + } else { + return false; + } + + if (!el) + return false; + + var offset = el.offset(); + + var iTop = el.outerHeight() / 2; + var iLeft = el.outerWidth() / 2; + + // placing position of jconfirm modal in center of clicked element + iTop -= this.$jconfirmBox.outerHeight() / 2; + iLeft -= this.$jconfirmBox.outerWidth() / 2; + + // absolute position on screen + var sourceTop = offset.top + iTop; + sourceTop = sourceTop - this._scrollTop(); + var sourceLeft = offset.left + iLeft; + + // window halved + var wh = $(window).height() / 2; + var ww = $(window).width() / 2; + + var targetH = wh - this.$jconfirmBox.outerHeight() / 2; + var targetW = ww - this.$jconfirmBox.outerWidth() / 2; + + sourceTop -= targetH; + sourceLeft -= targetW; + + // Check if the element is inside the viewable window. + if (Math.abs(sourceTop) > wh || Math.abs(sourceLeft) > ww) + return false; + + this.$jconfirmBoxContainer.css('transform', 'translate(' + sourceLeft + 'px, ' + sourceTop + 'px)'); + }, + _open: function () { + var that = this; + if (typeof that.onOpenBefore === 'function') + that.onOpenBefore(); + + this.$body.removeClass(this.animationParsed); + this.$jconfirmBg.removeClass('jconfirm-bg-h'); + this.$body.focus(); + + that.$jconfirmBoxContainer.css('transform', 'translate(' + 0 + 'px, ' + 0 + 'px)'); + + setTimeout(function () { + that.$body.css(that._getCSS(that.animationSpeed, 1)); + that.$body.css({ + 'transition-property': that.$body.css('transition-property') + ', margin' + }); + that.$jconfirmBoxContainer.addClass('jconfirm-no-transition'); + that._modalReady.resolve(); + if (typeof that.onOpen === 'function') + that.onOpen(); + + that.$el.addClass(that.loadedClass); + }, this.animationSpeed); + }, + loadedClass: 'jconfirm-open', + isClosed: function () { + return !this.$el || this.$el.css('display') === ''; + }, + isOpen: function () { + return !this.isClosed(); + }, + toggle: function () { + if (!this.isOpen()) + this.open(); + else + this.close(); + } + }; + + jconfirm.instances = []; + jconfirm.lastFocused = false; + jconfirm.pluginDefaults = { + template: '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
', + title: 'Hello', + titleClass: '', + type: 'default', + typeAnimated: true, + draggable: true, + dragWindowGap: 15, + dragWindowBorder: true, + animateFromElement: true, + /** + * @deprecated + */ + alignMiddle: true, + smoothContent: true, + content: 'Are you sure to continue?', + buttons: {}, + defaultButtons: { + ok: { + action: function () { + } + }, + close: { + action: function () { + } + } + }, + contentLoaded: function () { + }, + icon: '', + lazyOpen: false, + bgOpacity: null, + theme: 'light', + animation: 'scale', + closeAnimation: 'scale', + animationSpeed: 400, + animationBounce: 1, + escapeKey: true, + rtl: false, + container: 'body', + containerFluid: false, + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', + autoClose: false, + closeIcon: null, + closeIconClass: false, + watchInterval: 100, + columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', + boxWidth: '50%', + scrollToPreviousElement: true, + scrollToPreviousElementAnimate: true, + useBootstrap: true, + offsetTop: 40, + offsetBottom: 40, + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row' + }, + onContentReady: function () { + + }, + onOpenBefore: function () { + + }, + onOpen: function () { + + }, + onClose: function () { + + }, + onDestroy: function () { + + }, + onAction: function () { + + } + }; + + /** + * This refers to the issue #241 and #246 + * + * Problem: + * Button A is clicked (keydown) using the Keyboard ENTER key + * A opens the jconfirm modal B, + * B has registered ENTER key for one of its button C + * A is released (keyup), B gets the keyup event and triggers C. + * + * Solution: + * Register a global keydown event, that tells jconfirm if the keydown originated inside jconfirm + */ + var keyDown = false; + $(window).on('keydown', function (e) { + if (!keyDown) { + var $target = $(e.target); + var pass = false; + if ($target.closest('.jconfirm-box').length) + pass = true; + if (pass) + $(window).trigger('jcKeyDown'); + + keyDown = true; + } + }); + $(window).on('keyup', function () { + keyDown = false; + }); + jconfirm.lastClicked = false; + $(document).on('mousedown', 'button, a', function () { + jconfirm.lastClicked = $(this); + }); +})(jQuery, window); + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/resources/views/admin/pplace/_form.blade.php b/resources/views/admin/pplace/_form.blade.php new file mode 100644 index 0000000..0613d7b --- /dev/null +++ b/resources/views/admin/pplace/_form.blade.php @@ -0,0 +1,86 @@ +@if(Session::has('success')) + +@elseif(Session::has('error')) +
+ +

{{__('誤差')}}:

+ {!! Session::get('error') !!} +
+@elseif(isset($errorMsg)) +
+ +

{{__('誤差')}}:

+ {!! $errorMsg !!} +
+@endif + +
+ @if($isInfo) + {{ __('登録') }} + {{ __('編集') }} + @else + + @endif +
+ +
+
+ {{-- 駐輪車室ID --}} + @if($isInfo || $isEdit) +
+ +
+
+
+ +
+
+ @endif + + {{-- 番号 --}} +
+ +
+
+
+ +
+
+ + {{-- 備考 --}} +
+ +
+
+
+ +
+
+ + {{-- オペレーター --}} +
+ +
+
+ +
+
+ + @if($isInfo) + {{ __('登録') }} + {{ __('編集') }} + @else + + @endif +
diff --git a/resources/views/admin/pplace/add.blade.php b/resources/views/admin/pplace/add.blade.php new file mode 100644 index 0000000..5b31953 --- /dev/null +++ b/resources/views/admin/pplace/add.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 駐輪車室マスタ') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 駐輪車室マスタ

+
+
+ +
+
+
+
+ + + +
+
+
+
+
+
+ @csrf + @include('admin.pplace._form', ['isEdit' => 0, 'isInfo' => 0]) +
+
+
+
+ +
+ + + +
+
+
+ +@endsection diff --git a/resources/views/admin/pplace/edit.blade.php b/resources/views/admin/pplace/edit.blade.php new file mode 100644 index 0000000..aa8f830 --- /dev/null +++ b/resources/views/admin/pplace/edit.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 駐輪車室マスタ') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 駐輪車室マスタ

+
+
+ +
+
+
+
+ + + +
+
+
+
+
+
+ @csrf + @include('admin.pplace._form', ['isEdit' => 1, 'isInfo' => 0]) +
+
+
+
+ +
+ + + +
+
+
+ +@endsection diff --git a/resources/views/admin/pplace/info.blade.php b/resources/views/admin/pplace/info.blade.php new file mode 100644 index 0000000..b3ba05b --- /dev/null +++ b/resources/views/admin/pplace/info.blade.php @@ -0,0 +1,46 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 駐輪車室マスタ') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 駐輪車室マスタ

+
+
+ +
+
+
+
+ + +
+
+ +
+
+
+
+ @csrf + @include('admin.pplace._form', ['isEdit' => 0, 'isInfo' => 1]) +
+
+
+
+ +
+ + + +
+
+
+@endsection diff --git a/resources/views/admin/pplace/list.blade.php b/resources/views/admin/pplace/list.blade.php new file mode 100644 index 0000000..7e86000 --- /dev/null +++ b/resources/views/admin/pplace/list.blade.php @@ -0,0 +1,117 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 駐輪車室マスタ') +@section('content') +
+
+
+
+

{{__('駐輪車室マスタ')}}

+
+
+ +
+
+
+
+ +
+
+
+
+ @csrf + + +
+ +
+ + + + {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }} +
+ +
+ @if(Session::has('success')) + + @elseif(Session::has('error')) +
+ +

{{__('誤差')}}:

+ {!! Session::get('error') !!} +
+ @elseif(isset($errorMsg)) +
+ +

{{__('誤差')}}:

+ {!! $errorMsg !!} +
+ @endif +
+ +
+
+
+ @csrf + + + + + + + + @foreach($list as $item) + + + + @endforeach + +
+ + +
+
+
+ +
+
+ + + + + + + + + + @foreach($list as $item) + + + + + + @endforeach + +
+ {{__('ID')}} + + {{__('番号')}} + + {{__('備考')}} +
{{mb_substr($item->pplace_id, 0, 10)}}{{mb_substr($item->pplace_number, 0, 20)}}{{mb_substr($item->pplace_remarks, 0, 20)}}
+
+
+ +
+
+
+
+@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index f2b0e84..34b2ea7 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -33,7 +33,7 @@ - + @@ -247,61 +247,18 @@