html - Laravel:添加数据后如何使用 Laravel 打印票?
问题描述
好日子点子。单击创建后,我正在努力打印。
当我单击创建按钮时,它将添加到数据库并打印一个号码或票。我只知道 dompdf 但那个正在下载 pdf
<div class="modal fade" id="callModal" tabindex="-1" role="dialog" aria-labelledby="callModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="callModalLabel">New Call</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<!--start of the form-->
<form id="form-data" class="form-horizontal" method="POST" action="{{ route('call.store') }}">
{{ csrf_field() }}
<div class="row form-group">
<div class="col-md-12">
<input type="hidden" class="form-control" id="trans-id" name="trans_id" readonly>
</div>
<div class="col-md-12">
<label>Transaction Type:</label>
<input type="text" class="form-control" id="trans-name" readonly>
</div>
<div class="col-md-12">
<input type="hidden" id="called" name="called" value="NO">
</div>
<div class="col-md-12">
<label>Department:</label>
<select class="form-control" id="dept_id" name="dept_id" required>
<option value="" data-hidden="true"
selected="selected">-- Select Department --
</option>
@foreach($departments as $department)
<option value= "{{ $department->id }}">
{{ $department->dept_name }}
</option>
@endforeach
</select>
</div>
<div class="col-md-12">
<label>RFID</label>
<input type="text" id="rfid" class="form-control" name="rfid" required>
</div>
<div class="col-md-12">
<label>Student First Name</label>
<input type="text" id="firstname" class="form-control" name="firstname" required="">
</div>
<div class="col-md-12">
<label>Student Last Name</label>
<input type="text" id="lastname" class="form-control" name="lastname" required>
</div>
<div class="col-md-12">
<label>Amount</label>
<input type="number" id="amount" class="form-control" name="amount" step=".01" required>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-fill pull-right" id="form-button-add" name="form-button-add" onclick="window.print()">
CREATE <!--CREATE, SAVE AND PRINT THE TICKET-->
</button>
<button data-dismiss="modal" aria-hidden="true" class="btn btn-basic pull-right" style="margin-right: 2%">
CANCEL
</button>
<div class="clearfix"></div>
</form>
<!-- end of the form -->
</div>
</div>
</div>
</div>
我已经在我的创建按钮中编写了 javascript onclick 代码。我的问题是它打印 ui 的当前页面。我只想打印详细信息,例如 C-1,计数器 1。另一个问题是显示预览但它没有添加到数据库中。
解决方案
推荐阅读
- node.js - 如何在 Mongo/ 中获取嵌套元素
- gtk3 - 如何使用 vala 将 gtk 应用程序的背景设置为桌面壁纸
- java - 根据哪个过滤器过滤了流中的最后一个元素,做出不同的反应
- javascript - 如何在不使用formdata api的情况下使用axios上传文件?
- mysql - MySQL:为所有用户将数据从一个表中的字段移动到另一表中的字段
- php - 单击类别名称时,页面将重定向到 404 pge
- django - 如何将两个日期更改为天数和小时数
- javascript - React Storybook - 自定义道具导致“您可能需要适当的加载器来处理此文件类型”消息
- css - CSS网格:自动适应垂直跨度
- svelte - Svelte TypeError 无法解构 getContext(...) 的属性,因为它未定义