|
@@ -0,0 +1,92 @@
|
|
|
+<div moe>
|
|
|
+ <a class="text-nowrap" href="" show start>Upload Card Images</a>
|
|
|
+ <form url="/api/eligibilityCheck/create" style="min-width: 300px;" right>
|
|
|
+ <input type="hidden" name="insuranceCardUid" value="{{ $card->uid }}">
|
|
|
+ <div class="bg-light">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <div class="row border rounded pt-3 mb-3 bg-white">
|
|
|
+
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>Front Image</label>
|
|
|
+ <input type="file" file-picker name="frontImageUrl" class="form-control" />
|
|
|
+ <div class="d-nonex">
|
|
|
+ <img src="{{ $card->front_image_url }}" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-6">
|
|
|
+ <div class="form-group">
|
|
|
+ <label>Back Image</label>
|
|
|
+ <input type="file" file-picker name="backImageUrl" class="form-control" />
|
|
|
+ <div class="d-nonex">
|
|
|
+ <img src="{{ $card->back_image_url }}" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mb-0">
|
|
|
+ <button class="btn btn-default border btn-sm" cancel>Close</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+ (function($) {
|
|
|
+ const PUT_INFO_URL = "{{ route('patients.view.insurance-card-put-info', ['patient' => $patient, 'card' => $card]) }}";
|
|
|
+ const uploadCardImages = {
|
|
|
+ uploadBase64File: function(name, base64File) {
|
|
|
+ var self = this;
|
|
|
+ const params = {
|
|
|
+ webDisplayProfilePhotoBase64: base64File,
|
|
|
+ purpose: 'INSURANCE_CARD_IMAGE'
|
|
|
+ };
|
|
|
+ $.post('/api/systemFile/uploadBase64', params, function(response) {
|
|
|
+ if(response.success){
|
|
|
+ const fileUrl = '/api/systemFile/' + response.data;
|
|
|
+ const data = {
|
|
|
+ system_file_uid: response.data,
|
|
|
+ url: base64File
|
|
|
+ };
|
|
|
+ self.updateCardRecord({[name]: JSON.stringify(data)});
|
|
|
+ }else{
|
|
|
+ toastr.error(response.message);
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ },
|
|
|
+ updateCardRecord: function(params){
|
|
|
+ var self = this;
|
|
|
+ params.uid = "{{ $card->uid }}";
|
|
|
+ $.post(PUT_INFO_URL, params, function(response){
|
|
|
+ if(response.success){
|
|
|
+ toastr.success('Updated');
|
|
|
+ }else{
|
|
|
+ toastr.error(response.message);
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ },
|
|
|
+ initOnFileChange: function() {
|
|
|
+ var self = this;
|
|
|
+ $('[file-picker]').on('change', function(e) {
|
|
|
+ const name = e.currentTarget.name;
|
|
|
+ const file = e.target.files[0];
|
|
|
+ const reader = new FileReader();
|
|
|
+ reader.onload = function() {
|
|
|
+ const base64Image = reader.result;
|
|
|
+ self.uploadBase64File(name, base64Image);
|
|
|
+ };
|
|
|
+ if (file) {
|
|
|
+ reader.readAsDataURL(file);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ init: function() {
|
|
|
+ this.initOnFileChange();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ uploadCardImages.init();
|
|
|
+ })(jQuery);
|
|
|
+</script>
|