{"size": 11216, "ext": "js", "max_stars_repo_path": "public/js/admin_user.chunk.js", "max_stars_repo_name": "u9m31/u9m31", "max_stars_repo_stars_event_min_datetime": "2018-11-23T01:57:39.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-28T13:45:09.000Z", "max_issues_repo_path": "public/js/admin_user.chunk.js", "max_issues_repo_name": "u9m31/u9m31", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/js/admin_user.chunk.js", "max_forks_repo_name": "u9m31/u9m31", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 11216.0, "max_line_length": 11216, "alphanum_fraction": 0.692671184}
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"8nb2":function(e,t,s){"use strict";var o={name:"CSVDownload",props:{color:String,icon:String,title:String,url:String,filename:String},data:function(){return{csvdownloading:!1}},created:function(){console.log("CSV Download Btn created.")},methods:{csvdownload:function(e,t){console.log("CSV Download func csvdownload");this.csvdownloading=!0,axios.post(this.url,{responseType:"blob",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(e){this.csvdownloading=!1,this.saveCsvFile(e)}.bind(this)).catch(function(e){console.log("CSV Download csvdownload error"),this.csvdownloading=!1,console.log(e),e.response&&[401,419].includes(e.response.status)&&this.$emit("axios-logout")}.bind(this))},saveCsvFile:function(e){var t=new Blob(["\ufeff"+e.data],{type:"text/csv"}),s=this.filename;if(s||(s=this.$route.meta.name),s+="_"+moment(Date.now()).format("YYYYMMDD_HHmmss")+".csv",window.navigator.msSaveBlob)window.navigator.msSaveBlob(t,s),window.navigator.msSaveOrOpenBlob(t,s);else{var o=window.URL.createObjectURL(t),a=document.createElement("a");a.href=o,a.setAttribute("download",s),a.click()}}}},a=s("KHd+"),r=Object(a.a)(o,function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("v-btn",{attrs:{block:"",flat:"",color:e.color?e.color:"primary",loading:e.csvdownloading,disabled:e.csvdownloading},on:{click:function(t){return e.csvdownload(e.filename,e.url)}}},[s("v-icon",{staticClass:"mr-1",attrs:{dark:""}},[e._v(e._s(e.icon?e.icon:"cloud_download"))]),e._v(" "+e._s(e.title?e.title:"CSV ダウンロード")+"\n  "),s("v-progress-circular",{attrs:{slot:"csvdownload",indeterminate:"",color:"primary",dark:""},slot:"csvdownload"})],1)},[],!1,null,null,null);r.options.__file="CsvDownload.vue";t.a=r.exports},cXbX:function(e,t,s){"use strict";s.r(t);var o={name:"UserDialog",props:{},data:function(){return{dialog:!1,title:"編集",titlecolor:"primary",placeholder_password:"",type:"",items:{loginid:"",name:"",pass:"",role:!1},orig:{},error:{},rules:{required:function(e){return!!e||"Required."},min2:function(e){return e.length>=2||"Min 2 characters"},min6:function(e){return e.length>=6||"Min 6 characters"}}}},created:function(){console.log("User Dialog created.")},methods:{clearVar:function(){this.dialog=!0,this.clearError(),this.items=JSON.parse(JSON.stringify(this.error)),this.orig=JSON.parse(JSON.stringify(this.error))},clearError:function(){this.error={loginid:"",name:"",pass:"",role:!1}},close:function(){console.log("User Dialog func close"),this.dialog=!1},save:function(){console.log("User Dialog func save"),JSON.stringify(this.orig).replace(/[\s|　]+/g,"")!==JSON.stringify(this.items).replace(/[\s|　]+/g,"")?this.store():this.close()},open:function(e,t){console.log("User Dialog func open"),this.clearVar(),this.type=t?"D":e?"U":"C","C"==this.type&&(this.title="新規追加",this.titlecolor="primary",this.placeholder_password="パスワードを指定してください（未指定の場合はログインＩＤを設定）"),"U"==this.type&&(this.title="編集",this.titlecolor="accent",this.placeholder_password="変更する場合はパスワードを指定してください（未指定の場合は変更しない）"),"D"==this.type&&(this.title="削除",this.titlecolor="error",this.placeholder_password=""),e&&(e.loginid&&(this.items.loginid=e.loginid),e.name&&(this.items.name=e.name),e.role&&"管理者"==e.role&&(this.items.role=!0),this.orig=JSON.parse(JSON.stringify(this.items)))},store:function(){console.log("User Dialog func store");var e=new URLSearchParams;e.append("loginid",this.items.loginid),e.append("name",this.items.name),e.append("pass",this.items.pass),e.append("role",this.items.role?5:10),e.append("type",this.type),this.clearError(),axios.post("/api/admin/user/store",e).then(function(e){this.$emit("reload"),alert(this.items.name+"を保存しました"),this.close()}.bind(this)).catch(function(e){if(console.log("User Dialog store error"),console.log(e),e.response&&[401,419].includes(e.response.status))this.$emit("axios-logout");else{if(e.response&&[423].includes(e.response.status))return this.$emit("setsearch",this.items.loginid),void alert(e.response.data.message);if(e.response&&[422].includes(e.response.status)){if(alert(e.response.data.message),e.response.data.errors)for(var t in this.error)e.response.data.errors[t]&&(this.error[t]=e.response.data.errors[t]);return}}this.close()}.bind(this))},destroy:function(){console.log("User Dialog func destroy");var e=new URLSearchParams;e.append("loginid",this.items.loginid),axios.post("/api/admin/user/destroy",e).then(function(e){this.$emit("reload"),alert(this.items.name+"\nを削除しました"),this.close()}.bind(this)).catch(function(e){console.log("User Dialog destroy error"),console.log(e),e.response&&[401,419].includes(e.response.status)&&this.$emit("axios-logout"),e.response&&[422].includes(e.response.status)?alert(e.response.data.message):this.close()}.bind(this))}}},a=s("KHd+"),r=Object(a.a)(o,function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("transition",{attrs:{name:"fade"}},[s("v-dialog",{attrs:{"max-width":"650px",persistent:""},model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[s("v-btn",{staticClass:"mb-2",attrs:{slot:"activator",color:"primary",dark:"",flat:""},on:{click:function(t){return e.open(null)}},slot:"activator"},[s("v-icon",{staticClass:"pr-2"},[e._v("person_add")])],1),e._v(" "),s("v-card",[s("v-toolbar",{attrs:{color:e.titlecolor,dark:""}},[s("v-toolbar-title",[s("v-icon",{staticClass:"pb-1"},[e._v(e._s(e.$route.meta.icon))]),e._v(" "+e._s(e.$route.meta.name)+" | "+e._s(e.title))],1)],1),e._v(" "),s("v-card-text",[s("v-container",[s("v-layout",{attrs:{column:"",wrap:""}},[s("v-text-field",{staticClass:"pb-3",attrs:{label:"名前",placeholder:"氏名を入力してください","error-messages":e.error.name,rules:[e.rules.required,e.rules.min2],maxlength:"64",required:"",counter:"",disabled:"D"==e.type},model:{value:e.items.name,callback:function(t){e.$set(e.items,"name",t)},expression:"items.name"}}),e._v(" "),s("v-text-field",{staticClass:"pb-3",attrs:{label:"ログインID",placeholder:"社員ＩＤを入力してください","error-messages":e.error.loginid,rules:[e.rules.required,e.rules.min6],maxlength:"128",required:"",counter:"",disabled:"C"!=e.type},model:{value:e.items.loginid,callback:function(t){e.$set(e.items,"loginid",t)},expression:"items.loginid"}}),e._v(" "),s("v-text-field",{staticClass:"pb-2",attrs:{label:"パスワード",placeholder:e.placeholder_password,"error-messages":e.error.pass,maxlength:"128",counter:"",disabled:"D"==e.type},model:{value:e.items.pass,callback:function(t){e.$set(e.items,"pass",t)},expression:"items.pass"}}),e._v(" "),s("v-checkbox",{attrs:{label:"管理者権限",disabled:"D"==e.type},model:{value:e.items.role,callback:function(t){e.$set(e.items,"role",t)},expression:"items.role"}})],1)],1)],1),e._v(" "),s("v-card-actions",[s("v-btn",{attrs:{color:"grey    darken-1",flat:"",block:""},nativeOn:{click:function(t){return e.close(t)}}},[e._v("キャンセル")]),e._v(" "),s("v-btn",{directives:[{name:"show",rawName:"v-show",value:"D"!=e.type,expression:"type != 'D'"}],attrs:{color:"primary darken-1",flat:"",block:""},nativeOn:{click:function(t){return e.save(t)}}},[e._v("保存")]),e._v(" "),s("v-btn",{directives:[{name:"show",rawName:"v-show",value:"D"==e.type,expression:"type == 'D'"}],attrs:{color:"error   darken-1",flat:"",block:""},nativeOn:{click:function(t){return e.destroy(t)}}},[e._v("削除")])],1)],1)],1)],1)},[],!1,null,null,null);r.options.__file="UserDialog.vue";var i=r.exports,n=s("8nb2"),l=s("TqlJ"),c={name:"UserComponent",components:{"user-dialog":i,"csv-download":n.a,"csv-upload":l.a},props:{},data:function(){return{loading:!1,search:"",pagination:{sortBy:"name",descending:!1},tabledata:[],headers:[{align:"center",sortable:!1,text:"No"},{align:"left",sortable:!0,text:"社員ID",value:"loginid"},{align:"left",sortable:!0,text:"氏名",value:"name"},{align:"center",sortable:!0,text:"権限",value:"role"},{align:"center",sortable:!1,text:"アクション"}]}},created:function(){console.log("User Component created."),this.initialize()},methods:{initialize:function(){this.getUsers()},reload:function(){console.log("User Component reload"),this.getUsers()},setsearch:function(e){console.log("User Component set Search"),this.search=e},getUsers:function(){console.log("User Component getUsers"),this.loading=!0,axios.post("/api/admin/user").then(function(e){this.loading=!1,console.log(e),e.data.users&&(this.tabledata=e.data.users,this.setRole())}.bind(this)).catch(function(e){this.loading=!1,console.log(e),e.response&&[401,419].includes(e.response.status)&&this.$emit("axios-logout")}.bind(this))},setRole:function(){for(var e=0;e<this.tabledata.length;e++)this.tabledata[e].role&&(5==this.tabledata[e].role&&(this.tabledata[e].role="管理者"),10==this.tabledata[e].role&&(this.tabledata[e].role="ユーザ"))},dialogOpen:function(e,t){console.log("User Component dialog open"),this.$refs.userDialog.open(e,t||!1)}}},d=Object(a.a)(c,function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("v-flex",[s("v-card",{staticClass:"m-3 px-3",attrs:{xs12:""}},[s("v-card-title",{staticClass:"title"},[s("v-icon",{staticClass:"pr-2"},[e._v(e._s(e.$route.meta.icon))]),e._v(" "+e._s(e.$route.meta.name)+" "+e._s()+"\n      "),s("user-dialog",{ref:"userDialog",on:{reload:e.reload,setsearch:e.setsearch}}),e._v(" "),s("v-spacer"),e._v(" "),s("v-spacer"),e._v(" "),s("v-text-field",{attrs:{"prepend-icon":"search",label:"Search","single-line":"","hide-details":"",clearable:""},model:{value:e.search,callback:function(t){e.search=t},expression:"search"}})],1),e._v(" "),s("v-data-table",{staticClass:"elevation-0 p-1",attrs:{headers:e.headers,items:e.tabledata,pagination:e.pagination,"rows-per-page-items":[10,25,50,{text:"All",value:-1}],loading:e.loading,search:e.search},on:{"update:pagination":function(t){e.pagination=t}},scopedSlots:e._u([{key:"items",fn:function(t){return[s("tr",[s("td",{staticClass:"text-xs-center",attrs:{xs1:""}},[e._v(e._s(t.index+1+(e.pagination.page-1)*e.pagination.rowsPerPage))]),e._v(" "),e._l(e.headers.length-2,function(o){return[s("td",{class:"text-xs-"+e.headers[o].align,staticStyle:{"white-space":"nowrap"},domProps:{textContent:e._s(t.item[e.headers[o].value])}})]}),e._v(" "),s("td",{staticClass:"text-xs-center",attrs:{xs1:""}},[s("v-btn",{attrs:{flat:"",small:"",fab:""},on:{click:function(s){return e.dialogOpen(t.item)}}},[s("v-icon",{attrs:{color:"success"}},[e._v("edit")])],1),e._v(" "),s("v-btn",{attrs:{flat:"",small:"",fab:""},on:{click:function(s){return e.dialogOpen(t.item,!0)}}},[s("v-icon",{attrs:{color:"error"}},[e._v("delete")])],1)],1)],2)]}}])},[s("v-progress-linear",{attrs:{slot:"progress",color:"blue",indeterminate:""},slot:"progress"})],1),e._v(" "),s("v-spacer"),e._v(" "),s("v-card-actions",[s("v-btn",{attrs:{flat:"",block:"",color:"primary"},on:{click:function(t){return e.dialogOpen(null)}}},[s("v-icon",[e._v("person_add")]),e._v("新規追加")],1),e._v(" "),s("v-spacer"),e._v(" "),s("csv-download",{attrs:{url:"/api/admin/user/download",color:"primary"},on:{"axios-logout":function(t){return e.$emit("axios-logout")}}}),e._v(" "),s("csv-upload",{attrs:{url:"/api/admin/user/upload",multiple:"false"},on:{reload:e.reload,"axios-logout":function(t){return e.$emit("axios-logout")}}})],1)],1)],1)},[],!1,null,null,null);d.options.__file="UserComponent.vue";t.default=d.exports}}]);