@include('web.supplier.SupplierListFilter')

<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
    @if(checkPerm('AddSupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="add_supplier">新增</button>
    @endif
    @if(checkPerm('DisableSupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="disable_supplier">禁用</button>
    @endif
    @if(checkPerm('AuditSupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
    @endif
    {{--    @if(checkPerm('AllocatePurchaseUser'))--}}
    {{--        <button type="button" class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>--}}
    {{--    @endif--}}
    @if(checkPerm('BatchAllocatePurchaseUser'))
        {{--        <button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_purchase_user">批量分配渠道员</button>--}}
        <button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_purchase_user">分配渠道员</button>
    @endif
    @if(checkPerm('AllocateChannelUser'))
        <button type="button" class="layui-btn layui-btn-sm" id="allocate_channel_user">分配采购员</button>
    @endif
    @if(checkPerm('ChangeSupplierIsType'))
        <button type="button" class="layui-btn layui-btn-sm" title="该操作可以将竞调供应商转为正式供应商"
                id="change_supplier_is_type">
            转正供应商
        </button>
    @endif
    {{--        <button type="button" class="layui-btn layui-btn-sm" title="点击确定审核后会进入审核中状态"--}}
    {{--                id="batch_apply_in_review_supplier">--}}
    {{--            申请审核--}}
    {{--        </button>--}}
    @if(checkPerm('BlockSupplier'))
        {{--        <button type="button" class="layui-btn layui-btn-sm" id="block_supplier">--}}
        {{--            拉黑--}}
        {{--        </button>--}}
    @endif
    @if(request()->user->userId==1000 || request()->user->userId==2082)
        <button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到供应商"
                id="sync_supplier_to_erp">
            金蝶同步
        </button>
        <button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到一体化"
                id="sync_supplier_to_united">
            一体化同步
        </button>
    @endif
    @if(checkPerm('ApplySupplierShare'))
        {{--    @if(checkPerm('BlockSupplier'))--}}
        <button type="button" class="layui-btn layui-btn-sm" id="apply_supplier_share">
            共用申请
        </button>
    @endif
    @if(checkPerm('AuditSupplierShare'))
        <button type="button" class="layui-btn layui-btn-sm" id="audit_supplier_share_apply">
            共用审核
            @if (!empty($shareApplyCount))
                ({{$shareApplyCount}})
                <span style="margin-left: 0" class="layui-badge-dot layui-bg-orange"></span>
            @endif
        </button>
    @endif
    @if(checkPerm('BatchAddTag'))
        <button type="button" class="layui-btn layui-btn-sm" id="batch_add_tags">
            新增供应商标签
        </button>
    @endif
    @if(checkPerm('BatchAllocateYunxinChannelUser'))
        <button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_yunxin_channel_user">设置SKU采购
        </button>
    @endif
    @if(checkPerm('ExportSupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button>
    @endif
    @if(checkPerm('QuerySupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
    @endif
    @if(checkPerm('TransferSupplier'))
        <button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button>
    @endif
</div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table>
<script>
</script>

<script type="text/html" id="operate">
    <div style="text-align: left;">
        @if($canAudit)
            <a href="/supplier/AddSupplier?supplier_id=@{{ d.supplier_id}}" class="btn btn-xs btn-outline btn-success"
               target="_blank">修改</a>
        @else
            <a href="/supplier/AddSupplier?supplier_id=@{{ d.supplier_id}}" class="btn btn-xs btn-outline btn-success"
               target="_blank">查看</a>
        @endif
    </div>
</script>