diyform-form.blade.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('添加自定义表单'))
  4. <style type="text/css">
  5. .table>tbody>tr>td{
  6. overflow: inherit;
  7. }
  8. </style>
  9. <div class="right-titpos">
  10. <ul class="add-snav">
  11. <li class="active"><a href="#">添加自定义表单</a></li>
  12. </ul>
  13. </div>
  14. <div class='panel panel-default'>
  15. <form action="" method="post" class="form-horizontal form">
  16. <div class="col-sm-12">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;' >表单名称</label>
  19. <div class="col-sm-9 col-xs-12">
  20. <input type="text" name="tp_title" class="form-control tp_title" value="{{$item['title']}}" placeholder="表单名称,例:预约摄影" data-rule-required='true' />
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;'>前端查看用户表单</label>
  25. <div class="col-sm-9 col-xs-12">
  26. <label class="radio-inline"><input type="radio" class="" name="front_show"
  27. value="0"
  28. @if($item['front_show'] == 0) checked="checked" @endif />
  29. 关闭</label>
  30. <label class="radio-inline"><input type="radio" class="" name="front_show"
  31. value="1"
  32. @if($item['front_show'] == 1) checked="checked" @endif />
  33. 开启</label>
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;'>再次提交按钮(仅支持H5)</label>
  38. <div class="col-sm-9 col-xs-12">
  39. <label class="radio-inline"><input type="radio" class="" name="resubmit"
  40. value="0"
  41. @if($item['resubmit'] == 0) checked="checked" @endif />
  42. 关闭</label>
  43. <label class="radio-inline"><input type="radio" class="" name="resubmit"
  44. value="1"
  45. @if($item['resubmit'] == 1) checked="checked" @endif />
  46. 开启</label>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;' >表单图片</label>
  51. <div class="col-sm-9 col-xs-12 col-md-6 detail-logo">
  52. {!! app\common\helpers\ImageHelper::tplFormFieldImage('tp_thumb', $item['thumb']) !!}
  53. <span class="help-block">建议尺寸:375*154 </span>
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;'>详情介绍</label>
  58. <div class="col-sm-9 col-xs-12 col-md-9">
  59. {!! yz_tpl_ueditor('tp_description', $item['description']) !!}
  60. </div>
  61. </div>
  62. <div class="form-group">
  63. <label class="col-sm-2 control-label must" style='width:110px;text-align: left;padding-left:22px;'>分享描述</label>
  64. <div class="col-sm-9 col-xs-12">
  65. <textarea name="tp_share_description" class="form-control" rows="6">{{ $item['share_description'] }}</textarea>
  66. <span class='help-block'>注:用户分享时,显示的分享标题为表单名称,分享图片为表单图片</span>
  67. </div>
  68. </div>
  69. <table class='table'>
  70. <thead>
  71. <th style='width:90px'>类型</th>
  72. <th style='width:100px'>字段名称</th>
  73. <th style='width:50px'>必填</th>
  74. <th style='width:550px'>设置</th>
  75. <th></th>
  76. </thead>
  77. <tbody id="type-items">
  78. @if(!empty($dfields))
  79. @foreach($dfields as $k1 => $v1)
  80. <?php $data_type = $v1['data_type'];?>
  81. @if($datacount>0)
  82. {{$flag=2}}
  83. @endif
  84. @include('Yunshop\Diyform::admin.tpl.tpl')
  85. <?php $kw++;?>
  86. @endforeach
  87. @endif
  88. </tbody>
  89. <tr>
  90. <td colspan='5'>
  91. <div class='input-group'>
  92. <select id="data_type" name="data_type" class="form-control" style="width:200px;">
  93. @foreach($data_type_config as $key => $value)
  94. <option value="{{$key}}">{{$value}}</option>
  95. @endforeach
  96. </select>
  97. <div class='input-group-btn'>
  98. <a class="btn btn-primary btn-add-type" href="javascript:;" onclick="addType();"><i
  99. id="add_field" class="fa fa-plus" title=""></i> 增加一个字段</a>
  100. </div>
  101. </div>
  102. </td>
  103. </tr>
  104. </table>
  105. </div>
  106. <div class="form-group">
  107. <div class="col-sm-9 col-xs-12">
  108. <input type="submit" value="提交" class="btn btn-primary"/>
  109. <a href="{{yzUrl("plugin.diyform.admin.diyform.manage")}}"><span class="btn btn-default"
  110. style='margin-left:10px;'>返回列表</span></a>
  111. </div>
  112. </div>
  113. </form>
  114. </div>
  115. <div style="width:100%;height:150px;"></div>
  116. @include('Yunshop\Diyform::admin.tpl.script')
  117. <script language='javascript'>
  118. $('form').submit(function(){
  119. var check = true;
  120. $(".tp_title,.tp_name").each(function(){
  121. var val = $.trim($(this).val());
  122. // console.log(this,typeof val,val)
  123. if(!val){
  124. // console.log(val+"不为空");
  125. $(this).focus();
  126. //$('form').attr('stop',1).tip.msgbox.err('不能为空!');
  127. alert("不能为空");
  128. check =false;
  129. return false;
  130. }
  131. });
  132. if(kw == 0) {
  133. $(this).focus(),$('form').attr('stop',1),tip.msgbox.err('请先添加字段再提交!');
  134. check =false;
  135. return false;
  136. }
  137. if(!check){return false;}
  138. var o={}; // 判断重复
  139. if(!check){
  140. return false;
  141. }
  142. $('form').removeAttr('stop');
  143. return true;
  144. });
  145. </script>
  146. @endsection