pull/624/head
hydarakb 3 months ago
parent 048d075160
commit 2e5fe4c830

@ -10,7 +10,6 @@ class SsoLoginController < ApplicationController
def login
token = params[:token]
template_id = params[:template_id]
unless token.present?
return redirect_to root_path, alert: 'Missing authentication token'
@ -23,6 +22,7 @@ class SsoLoginController < ApplicationController
email = decoded_token['email']&.downcase
first_name = decoded_token['first_name']
last_name = decoded_token['last_name']
template_id = decoded_token['template_id']
# Check for facility_id/facility_name first (new payload format), then fallback to company_id/company_name
company_id = decoded_token['facility_id'] || decoded_token['company_id'] || decoded_token['account_id'] || decoded_token['organization_id']
company_name = decoded_token['facility_name'] || decoded_token['company_name'] || decoded_token['account_name'] || decoded_token['organization_name']
@ -44,7 +44,8 @@ class SsoLoginController < ApplicationController
# Redirect to template preview if template_id is present
if template_id.present?
return redirect_to controller: 'templates', action: 'preview', id: template_id
Rails.logger.error("It is here actually. TemplateID: #{template_id}")
return redirect_to template_preview_path(template_id)
end
# Redirect to dashboard

@ -175,7 +175,8 @@ safeRegisterElement('template-builder', class extends HTMLElement {
withDownload: true,
currencies: (this.dataset.currencies || '').split(',').filter(Boolean),
acceptFileTypes: this.dataset.acceptFileTypes,
showTourStartForm: this.dataset.showTourStartForm === 'true'
showTourStartForm: this.dataset.showTourStartForm === 'true',
predefinedFields: JSON.parse(this.dataset.predefinedFields || '[]')
})
this.component = this.app.mount(this.appElem)
@ -219,4 +220,4 @@ safeRegisterElement('import-list', class extends HTMLElement {
this.app?.unmount()
this.appElem?.remove()
}
})
})

@ -489,10 +489,12 @@
:only-defined-fields="onlyDefinedFields"
:editable="editable"
:show-tour-start-form="showTourStartForm"
:predefined-fields="predefinedFields"
@add-field="addField"
@set-draw="[drawField = $event.field, drawOption = $event.option]"
@select-submitter="selectedSubmitter = $event"
@set-draw-type="[drawFieldType = $event, showDrawField = true]"
@set-draw-with-name="[drawFieldType = $event.type, drawFieldName = $event.name, showDrawField = true]"
@set-drag="dragField = $event"
@set-drag-placeholder="$refs.dragPlaceholder.dragPlaceholder = $event"
@change-submitter="selectedSubmitter = $event"
@ -885,6 +887,11 @@ export default {
type: Boolean,
required: false,
default: false
},
predefinedFields: {
type: Array,
required: false,
default: () => []
}
},
data () {
@ -902,6 +909,7 @@ export default {
pendingFieldAttachmentUuids: [],
drawField: null,
drawFieldType: null,
drawFieldName: '',
drawOption: null,
dragField: null,
isDragFile: false
@ -1390,7 +1398,7 @@ export default {
},
addField (type, area = null) {
const field = {
name: '',
name: this.drawFieldName || '',
uuid: v4(),
required: type !== 'checkbox',
areas: area ? [area] : [],
@ -1428,6 +1436,8 @@ export default {
field.preferences.with_signature_id = this.withSignatureId
}
this.drawFieldName = ''
this.insertField(field)
this.save()
@ -1515,6 +1525,7 @@ export default {
this.drawField = null
this.drawOption = null
this.showDrawField = false
this.drawFieldName = ''
if (!this.withSelectedFieldType) {
this.drawFieldType = ''
@ -2724,4 +2735,4 @@ export default {
}
}
}
</script>
</script>

@ -192,6 +192,23 @@
</div>
</template>
</div>
<div
v-if="predefinedFields.length && editable"
class="mt-2"
>
<div class="text-xs text-base-content/50 font-medium px-1 pb-1 uppercase tracking-wide">Predefined Fields</div>
<div class="grid grid-cols-1 gap-1">
<button
v-for="field in predefinedFields"
:key="field.name"
class="btn btn-sm btn-outline w-full justify-start text-sm font-normal"
@click="$emit('set-draw-with-name', { name: field.name, type: field.type || 'text' })"
>
<FieldType :model-value="field.type || 'text'" :editable="false" :button-width="16" />
<span class="ml-1 truncate">{{ field.title || field.name }}</span>
</button>
</div>
</div>
<div
v-if="fields.length < 4 && editable && withHelp && !showTourStartForm"
class="text-xs p-2 border border-base-200 rounded"
@ -370,9 +387,14 @@ export default {
type: Boolean,
required: false,
default: false
},
predefinedFields: {
type: Array,
required: false,
default: () => []
}
},
emits: ['add-field', 'set-draw', 'set-draw-type', 'set-drag', 'drag-end', 'scroll-to-area', 'change-submitter', 'set-drag-placeholder', 'select-submitter'],
emits: ['add-field', 'set-draw', 'set-draw-type', 'set-drag', 'drag-end', 'scroll-to-area', 'change-submitter', 'set-drag-placeholder', 'select-submitter', 'set-draw-with-name'],
data () {
return {
fieldPagesLoaded: null,
@ -620,4 +642,4 @@ export default {
}
}
}
</script>
</script>

@ -6,4 +6,29 @@
<%= button_to nil, user_configs_path, method: :post, params: { user_config: { key: UserConfig::SHOW_APP_TOUR, value: true } }, class: 'hidden', id: 'start_tour_button' %>
<% end %>
<% end %>
<template-builder class="grid" data-template="<%= @template_data %>" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-fields-detection="true" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-locale="<%= I18n.locale %>" data-show-tour-start-form="<%= @show_tour_start_form %>"></template-builder>
<% predefined_fields = [
{ name: 'units', type: 'number', title: 'Units' },
{ name: 'schedule_date', type: 'date', title: 'Schedule Date' },
{ name: 'from_time', type: 'text', title: 'From Time' },
{ name: 'to_time', type: 'text', title: 'To Time' },
{ name: 'place_of_service', type: 'text', title: 'Place of Service' },
{ name: 'time_duration', type: 'text', title: 'Time Duration' },
{ name: 'supervisor_name', type: 'text', title: 'Supervisor Name' },
{ name: 'provider_npi', type: 'text', title: 'Provider NPI' },
{ name: 'provider_name', type: 'text', title: 'Provider Name' },
{ name: 'provider_credential_type', type: 'text', title: 'Provider Credential Type' },
{ name: 'patient_name', type: 'text', title: 'Patient Name' },
{ name: 'patient_first_name', type: 'text', title: 'Patient First Name' },
{ name: 'patient_last_name', type: 'text', title: 'Patient Last Name' },
{ name: 'patient_gender', type: 'text', title: 'Patient Gender' },
{ name: 'patient_dob', type: 'date', title: 'Patient DOB' },
{ name: 'patient_address', type: 'text', title: 'Patient Address' },
{ name: 'patient_phone', type: 'text', title: 'Patient Phone' },
{ name: 'patient_initials', type: 'initials', title: 'Patient Initials' },
{ name: 'patient_age', type: 'number', title: 'Patient Age' },
{ name: 'patient_language', type: 'text', title: 'Patient Language' },
{ name: 'patient_parent_name', type: 'text', title: 'Patient Parent Name' },
{ name: 'patient_first_seen_date', type: 'date', title: 'Patient First Seen Date' },
{ name: 'payor_name', type: 'text', title: 'Payor Name' }
] %>
<template-builder class="grid" data-template="<%= @template_data %>" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-fields-detection="true" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-locale="<%= I18n.locale %>" data-show-tour-start-form="<%= @show_tour_start_form %>" data-predefined-fields="<%= predefined_fields.to_json %>"></template-builder>
Loading…
Cancel
Save