{extend name="main"}
{block name="style"}
{css href="__TEMPLATE_STATIC__/user.css"}
<style type="text/css">
	.inviteAnInterviewForm .el-dialog{min-width: 768px;}
	.inviteAnInterviewForm>.el-input, .inviteAnInterviewForm>.el-select{width: 40%;}
	.el-date-editor.el-input, .el-date-editor.el-input__inner{width: 100%;}
</style>
{/block}
{block name="header"}
{include file="module/user_top_nav"/}
{/block}
{block name="body"}
<div class="flex1 flex h-100">
	<div class="w-180px bg-dark p-4 overflow-y-auto">
	{include file="module/user/company_left" left="module/user/company_left_resume"/}
	</div>
	<div class="frame-body flex-1 overflow-y-auto py-3">
		<div class="container-xl bg-white shadow">
			<div class="flex mb-3">
				<div class="flex-1 block-title-before py-2">我发起的视频面试邀请</div>
			</div>
			<div class="bg-1E54E5 p-3 my-3 flex">
				<div><i class="el-icon-warning h3 mb-0 text-primary"></i></div>
				<div class="flex-1 pl-2">
					<div class="text-secondary">为提高视频面试效率，建议您在面试前提前检查您的设备是否能够正常连通</div>
					<div class="text-primary">视频面试房间仅在面试当天开启，在面试时间15天之后自动关闭</div>
				</div>
				<div class="pl-3">
					<el-button type="primary" plain round size="mini">点击立即检测</el-button>
				</div>
			</div>
			<div class="table-responsive">
				<el-table
					ref="multipleTable"
			      	:data="tableData"
		    		stripe
		    		v-loading="search.ajax"
		    		style="width: 100%;"
		    		header-cell-class-name="bg-1E54E5 text-666666"
    				@selection-change="handleSelectionChange">
			      <el-table-column
			        type="selection"
			        width="50">
			      </el-table-column>
				  	<el-table-column
			        prop="name"
			        label="ID"
			        width="100">
				      <template slot-scope="scope">
				      	<el-link :href="'/resume/'+scope.row.resume_id+'.html'"
				      	:underline="false"
				      	target="_blank">{{scope.row.id}}</el-link>
				      </template>
			      </el-table-column>
				  
			      <el-table-column
			        prop="name"
			        label="名称"
			        width="100">
				      <template slot-scope="scope">
				      	<el-link :href="'/resume/'+scope.row.resume_id+'.html'"
				      	:underline="false"
				      	target="_blank">{{scope.row.name}}</el-link>
				      </template>
			      </el-table-column>
			      <el-table-column
			        label="基本信息"
			        width="180">
			        <template slot-scope="scope">
			        	{{XYBase.Date.getMStoYear(scope.row.age*1000)}}/
						<span v-if="scope.row.sex==1">男</span>
						<span v-else-if="scope.row.sex==2">女</span>
						<span v-else="scope.row.sex">未设置</span>
			        	/{{scope.row.educational_background}}/{{XYBase.Date.getMStoYear(scope.row.work_experience_time*1000)}}年经验
			        </template>
			      </el-table-column>
			      <el-table-column
			        prop="title"
			        label="意向职位"
			        width="160">
				      <template slot-scope="scope">
				      	<el-link :href="'/jobs/'+scope.row.jobs_id+'.html'"
				      	:underline="false"
				      	target="_blank">{{scope.row.title}}</el-link>
				      </template>
			      </el-table-column>
			      <el-table-column
			        prop="create_time"
			        label="时间"
			        show-overflow-tooltip>
			      </el-table-column>
			      <el-table-column
			        label="筛选"
			        width="80">
			        <template slot-scope="scope">
			        	<el-tag
						    v-if="scope.row.status===0"
		        			type="info"
						    effect="plain"
						    :disable-transitions="true"
						    size="mini">
						    等待面试
						</el-tag>
			        	<el-tag
						    v-else-if="scope.row.status===1"
		        			type="success"
						    effect="plain"
						    :disable-transitions="true"
						    size="mini">
						    面试中
						</el-tag>
			        	<el-tag
						    v-else-if="scope.row.status===2"
		        			type="danger"
						    effect="plain"
						    :disable-transitions="true"
						    size="mini">
						    已结束
						</el-tag>
			        </template>
			      </el-table-column>
			      <el-table-column
			        label="操作"
			        width="160">
			        <template slot-scope="scope">
			        	<el-button-group class="text-nowrap">
						  <el-button type="warning" size="minism" @click="handleInterviewInvitation(scope.row);">面试信息</el-button>
						  <el-button type="success" size="minism" @click="handleInterviewInvitation(scope.row);" v-if="scope.row.status === 1">进入房间</el-button>
						</el-button-group>
			        </template>
			      </el-table-column>
			    </el-table>
			</div>
			<div class="pt-3">
				<el-button-group class="text-nowrap">
				  <el-button type="primary" size="mini">设为已读</el-button>
				  <el-button type="danger" size="mini">删除</el-button>
				</el-button-group>
			</div>
			<div class="table-responsive py-3 text-center">
				<el-pagination
				  background
				  :hide-on-single-page="true"
				  @current-change="setPageChange"
			      :current-page="search.page"
			      :page-size="15"
			      layout="total,  prev, pager, next, jumper"
			      :total="search.total">
			    </el-pagination>
			</div>
		</div>
	</div>
</div>
<el-drawer
  title="我是标题"
  :visible.sync="drawerHandleInterviewInvitation"
  :with-header="false">
  	<div class="wrap h-100">
		<div class="flex px-3 py-2">
			<div class="flex-1 block-title-before py-2">面试邀请信息</div>
			<div class="py-2">
	        	<el-tag
	        		v-if="handleInterviewInvitationData.status === 0"
	        		type="info"
				    effect="plain"
				    :disable-transitions="true"
				    size="mini">
				    等待接受
				</el-tag>
	        	<el-tag
	        		v-else-if="handleInterviewInvitationData.status === 1"
	        		type="warning"
				    effect="plain"
				    :disable-transitions="true"
				    size="mini">
				    等待面试
				</el-tag>
	        	<el-tag
	        		v-else-if="handleInterviewInvitationData.status === 2"
	        		type="danger"
				    effect="plain"
				    :disable-transitions="true"
				    size="mini">
				    已拒绝
				</el-tag>
			</div>
		</div>
  		<div class="flex1 p-3 overflow-auto">
		  	<table v-if="handleInterviewInvitationData.id" class="table table-bordered">
			  	<tr>
			  		<td width="120" class="text-secondary text-right">职位名称：</td>
			  		<td>{{handleInterviewInvitationData.title}}</td>
			  	</tr>
			  	<tr>
			  		<td width="120" class="text-secondary text-right">公司名称：</td>
			  		<td>{{handleInterviewInvitationData.company_name}}</td>
			  	</tr>
			  	<tr>
			  		<td class="text-secondary text-right">面试联系人：</td>
			  		<td>{{handleInterviewInvitationData.contacts}}</td>
			  	</tr>
			  	<tr>
			  		<td class="text-secondary text-right">联系人手机：</td>
			  		<td>{{handleInterviewInvitationData.contacts_mobile}}</td>
			  	</tr>
			  	<tr v-if="handleInterviewInvitationData.contacts_tel">
			  		<td class="text-secondary text-right">联系人座机：</td>
			  		<td>{{handleInterviewInvitationData.contacts_tel}}</td>
			  	</tr>
			  	<tr v-if="handleInterviewInvitationData.contacts_email">
			  		<td class="text-secondary text-right">联系人邮箱：</td>
			  		<td>{{handleInterviewInvitationData.contacts_email}}</td>
			  	</tr>
			  	<tr>
			  		<td class="text-secondary text-right">面试地址：</td>
			  		<td>{{handleInterviewInvitationData.address}}</td>
			  	</tr>
			  	<tr>
			  		<td class="text-secondary text-right">面试时间：</td>
			  		<td>
			  			<span class="pr-3">
			  				{{handleInterviewInvitationData.interview_date}}
			  			</span>
			  			<span>
			  				{{handleInterviewInvitationData.interview_start_time}}
			  				~
			  				{{handleInterviewInvitationData.interview_end_time}}
			  			</span>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td class="text-secondary text-right">备注：</td>
			  		<td>{{handleInterviewInvitationData.remarks}}</td>
			  	</tr>
		  	</table>
	  	</div>
  	</div>
</el-drawer>
{/block}
{block name="footer"}
{include file="module/login"/}
{/block}
{block name="script"}
<script type="text/javascript">
	var vm=new Vue({
		el:'#app',
		data:{
			view:XYBase.view,
			userInfo:UserInfo,
			loginTabs:XYBase.loginTabs,
			feedback:XYBase.feedback,
			drawerHandleInterviewInvitation:false,
			handleInterviewInvitationData:{},
			search:{
		    	ajax:false,
				total:100,
				page: 1
			},
			tableData:[],
		},
		watch:{
		    view:XYBase.viewWatch,
		    loginTabs:XYBase.loginTabsWatch,
			userInfo:{
				handler(val,oldVal){
					if (!val.id) {
						window.location.reload();
					}
				},
				deep:true
			},
		},
		created(){
			XYBase.created(this);
			this.initHtml();
		},
		methods:XYBase.methods({
			toggleSelection(rows) {
				if (rows) {
				  rows.forEach(row => {
				    this.$refs.multipleTable.toggleRowSelection(row);
				  });
				} else {
				  this.$refs.multipleTable.clearSelection();
				}
			},
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			filterHandler(value, row, column){
				console.log(value);
		        const property = column['property'];
		        return row[property] === value;
			},
			handleInterviewInvitation(row){
				this.handleInterviewInvitationData=row;
				this.drawerHandleInterviewInvitation=true;
			},
			setPageChange(val){
				this.search.page=val;
				this.initHtml();
			},
			initHtml(){
				var _this=this;
				_this.search.ajax=true;
				_this.sendGet({
					url:'',
					data:_this.search,
				},function(ret){
					_this.search.ajax=false;
					if (ret) {
						_this.tableData=[];
						_this.search.total=ret.data.total;
						if (ret.code === 0) {
							_this.search.page++;
							_this.tableData=ret.data.data;
						}else XYBase.msg(ret.msg);
					}
				});
			},
			submitForm:function(formName) {
				var _this=this;
				var D=_this.form;
				_this.$refs[formName].validate((valid) => {
				  if (valid) {
					const loading = XYBase.openloading();
					_this.sendPost({
						url:url,
						data:D,
					},function(ret){
				        loading.close();
				        if (ret) {
							if(ret.code == 0){
								XYBase.success(ret.msg);
							}else{
								XYBase.msg(ret.msg);
							}
				        }
					});
				  } else {
					XYBase.warning('请先把表单填写完整。');
				    return false;
				  }
				});
			},
		})
	});
</script>
{/block}