123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- @extends('module.layouts.company')
- @push('meta')
- @endpush
- @push('css')
- <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/common.css') }}"/>
- <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_user.css')}}"/>
- <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_ajax_dialog.css')}}"/>
- @endpush
- @section('content')
- <div class="user_main">
- <div class="mleft">
- @include('module.section.company_left')
- </div>
- <div class="mright">
- <div class="user_pagetitle pms_user_pagetitle" style="position: relative;">
- <div class="pat_l">联系信息</div>
- <div class="clear"></div>
- <div class="btnbox" style="position: absolute;right:0px;top:0px">
- <div class="btn_yellow J_hoverbut btn_add J_contact_add" style="margin-right:0px;">
- 添加联系人
- </div>
- </div>
- </div>
- <div class="user_tab">
- <a href="{{ route('com.contact') }}" class="tabli select">联系信息</a>
- <div class="clear"></div>
- </div>
- <div class="pms_wrap J_allListBox">
- @if($contacts->isNotEmpty())
- <div class="pms_th">
- <div class="th1" style="width: 140px;">联系人</div>
- <div class="th1" style="width: 120px;padding-left: 10px;">联系电话</div>
- <div class="th1" style="width: 200px;">邮箱</div>
- <div class="th4" style="width: 160px;text-align: center">操作</div>
- <div class="clear"></div>
- </div>
- @foreach($contacts as $k=>$v)
- <div class="pms J_hoverbut contact" contact_id="{{$v->id}}">
- <div class="td1 substring nowrap link_blue" style="padding-right: 0px;width: 160px;">
- <input class="J_allList chk" type="checkbox" name="id[]" value="{{$v->id}}">
- {{$v->contact}}
- </div>
- <div class="td2 substring" style="width: 160px;">
- @if($v->telephone)
- {{$v->telephone}}
- @else
- {{dealContactPhone($v->landline_tel)}}
- @endif
- </div>
- <div class="td2 substring" style="width: 230px;">{{$v->email}}</div>
- <div class="td2 link_blue" style="width: 160px;text-align: center;">
- <a href="javascript:;" class="J_contact_check">查看</a>
- <a href="javascript:;" class="J_contact_edit">编辑</a>
- <a href="javascript:;" url="{{ route('com.contact.del') }}" class="delete">删除</a>
- </div>
- <div class="clear"></div>
- </div>
- @endforeach
- <div class="pms_btn">
- <div class="allSelWrap">
- <input name="" class="allSel J_allSelected" type="checkbox">
- </div>
- <div class="btn_lightgray J_hoverbut btn_inline btn_border J_delall">删除</div>
- <div class="clear"></div>
- </div>
- {{ $contacts->links('module.widgets.pagination') }}
- @else
- <div style="text-align: center;">暂无联系人信息</div>
- @endif
- </div>
- </div>
- <div class="clear"></div>
- </div>
- @endsection
- @section('script')
- <script type="text/javascript" src="{{ theme_asset('app/js/jquery.dropdown.js') }}"></script>
- <script type="text/javascript" src="{{ theme_asset('app/js/jquery.listitem.js')}}"></script>
- <script type="text/javascript" src="{{ theme_asset('app/js/jquery.disappear.tooltip.js') }}"></script>
- <script type="text/javascript" src="{{ theme_asset('app/js/company/jquery.common.js') }}"></script>
- <script type="text/javascript" src="{{ theme_asset('app/js/jquery.allselected.js') }}"></script>
- <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
- <script type="text/javascript">
- function checkForm() {
- var contactValue = $.trim($('#contact').val());
- var telephoneValue = $.trim($('#telephone').val());
- var telfirstValue = $.trim($('#tel_first').val());
- var telnextValue = $.trim($('#tel_next').val());
- var tellastValue = $.trim($('#tel_last').val());
- var landlinetelValue = telfirstValue+'-'+telnextValue+'-'+tellastValue;
- var emailValue = $.trim($('#email').val());
- var addressValue = $.trim($('#address').val());
- if (contactValue == "") {
- disapperTooltip('remind','请输入联系人');
- return false;
- }
- if (contactValue != "" && contactValue.length > 10) {
- disapperTooltip('remind','联系人1-10个字');
- return false;
- }
- if(telnextValue=="" && telephoneValue=="") {
- disapperTooltip('remind','手机号码和固定电话至少填写一项');
- return false;
- } else {
- if (telephoneValue != "" && !regularMobile.test(telephoneValue)) {
- disapperTooltip('remind','手机号码格式不正确');
- return false;
- }
- }
- //电话号码填写的某个不为空
- /**
- * 分机号可以为空
- */
- if(telfirstValue!="" || telnextValue!="" || tellastValue!=""){
- if (!regularTelFirst.test(telfirstValue)) {
- disapperTooltip("remind", "请填写正确的区号");
- return false;
- }
- if (!regularTelNext.test(telnextValue)) {
- disapperTooltip("remind", "电话号码为6-11位数字");
- return false;
- }
- if ((!regularTelLast.test(tellastValue) || tellastValue.length > 4) && tellastValue!="") {
- disapperTooltip("remind", "分机号码为数字且不能超出4位");
- return false;
- }
-
- }
- if (emailValue != "" && !regularEmail.test(emailValue) || emailValue.split("@")[0].length > 20) {
- disapperTooltip('remind','邮箱格式不正确');
- return false;
- }
- if (addressValue == "") {
- disapperTooltip('remind','联系地址不能为空');
- return false;
- }
- if (addressValue != "" && addressValue.length > 30) {
- disapperTooltip('remind','联系地址不能大于30个字');
- return false;
- }
- return true;
- }
- //添加联系人
- $('.J_contact_add').click(function(){
- var qsDialog = $(this).dialog({
- title: '添加联系人',
- loading: true,
- btns: ['确定', '取消'],
- showFooter: false,
- yes: function() {
- qsDialog.setCloseDialog(false);
- var form_data = $('#contact_content').serialize();
- if (checkForm()) {
- $.post("{{ route('com.contact.add') }}",form_data,function(result){
- if(result.status == 1){
- disapperTooltip('success',result.msg);
- setTimeout(function(){
- window.location.reload();
- },2000);
- }else{
- disapperTooltip('remind',result.msg);
- }
- },'json');
- }
- }
- });
- $.getJSON("{{ route('com.contact.add') }}",function(result){
- if(result.status == 1){
- qsDialog.setContent(result.data);
- qsDialog.showFooter(true);
- }else{
- qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
- }
- });
- });
- //编辑联系人
- $('.J_contact_edit').click(function(){
- var f = $(this).closest('.contact');
- var id = f.attr('contact_id');
- var qsDialog = $(this).dialog({
- title: '编辑联系人',
- loading: true,
- btns: ['确定', '取消'],
- showFooter: false,
- yes: function() {
- qsDialog.setCloseDialog(false);
- if (checkForm()) {
- var form_data = $('#contact_content').serialize();
- $.post("{{ route('com.contact.edit') }}",form_data,function(result){
- if(result.status == 1){
- disapperTooltip('success',result.msg);
- setTimeout(function(){
- window.location.reload();
- },2000);
- }else{
- disapperTooltip('remind',result.msg);
- }
- },'json');
- }
- }
- });
- $.getJSON("{{ route('com.contact.edit') }}",{id:id},function(result){
- if(result.status == 1){
- qsDialog.setContent(result.data);
- qsDialog.showFooter(true);
- }else{
- qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
- }
- });
- });
- //查看联系人
- $('.J_contact_check').click(function(){
- var f = $(this).closest('.contact'),
- id = f.attr('contact_id');
- var qsDialog = $(this).dialog({
- title: '企业联系人详情',
- loading: true,
- footer: false
- });
- $.getJSON("{{ route('com.contact.show') }}",{id:id},function(result){
- if(result.status == 1){
- qsDialog.setContent(result.data);
- qsDialog.showFooter(true);
- }else{
- qsDialog.setContent(result.msg);
- }
- });
- });
- //删除联系人
- $(".delete").click(function () {
- var url = $(this).attr('url'),
- f = $(this).closest('.contact'),
- id = f.attr('contact_id');
- var qsDialog = $(this).dialog({
- title: '删除企业联系人',
- loading: true,
- border: false,
- yes: function () {
- $.post(url,{id:id,_token: "{{csrf_token()}}"},function(result){
- if(result.status == 1){
- f.remove();
- disapperTooltip('success',result.msg);
- setTimeout(function () {
- location.href="{{route('com.contact')}}"
- },1000)
- }else{
- disapperTooltip('remind',result.msg);
- }
- },'json');
- }
- });
- qsDialog.setContent('被删除后将无法恢复,您确定要删除选中的企业联系信息吗?');
- });
- $('.J_delall').click(function(){
- var listCheckedArray = $('.J_allListBox .J_allList:checked');
- if (listCheckedArray.length) {
- var idarr = new Array();
- $.each($("input[name='id[]']:checked") ,function(){
- idarr.push($(this).val());
- });
- var qsDialog = $(this).dialog({
- title: '删除企业联系人',
- loading: true,
- border: false,
- yes: function () {
- $.post("{{ route('com.contact.del') }}",{id:idarr,_token: "{{csrf_token()}}"},function(result){
- if(result.status == 1){
- listCheckedArray.closest('.contact').remove();
- $(".J_allListBox input[type='checkbox']").prop("checked",false);
- disapperTooltip('success',result.msg);
- setTimeout(function () {
- location.href="{{route('com.contact')}}"
- },1000)
- }else{
- disapperTooltip('remind',result.msg);
- }
- },'json');
- }
- });
- qsDialog.setContent('被删除后将无法恢复,您确定要删除选中的企业联系信息吗?');
- } else {
- disapperTooltip("remind", "请选择要删除的联系信息");
- }
- });
- </script>
- @endsection
|