Metamigo -> Bridge

This commit is contained in:
Darren Clarke 2024-04-21 09:44:30 +02:00
parent 242f3cf6b8
commit a445762a37
145 changed files with 396 additions and 16668 deletions

View file

@ -0,0 +1,249 @@
class Index extends App.ControllerSubContent
requiredPermission: 'admin.channel_cdr_signal'
events:
'click .js-new': 'new'
'click .js-edit': 'edit'
'click .js-delete': 'delete'
'click .js-disable': 'disable'
'click .js-enable': 'enable'
'click .js-rotate-token': 'rotateToken'
constructor: ->
super
#@interval(@load, 60000)
@load()
load: =>
@startLoading()
@ajax(
id: 'cdr_signal_index'
type: 'GET'
url: "#{@apiPath}/channels_cdr_signal"
processData: true
success: (data) =>
@stopLoading()
App.Collection.loadAssets(data.assets)
@render(data)
)
render: (data) =>
channels = []
for channel_id in data.channel_ids
channel = App.Channel.find(channel_id)
if channel && channel.options
displayName = '-'
if channel.group_id
group = App.Group.find(channel.group_id)
displayName = group.displayName()
channel.options.groupName = displayName
channels.push channel
@html App.view('cdr_signal/index')(
channels: channels
)
new: (e) =>
e.preventDefault()
new FormAdd(
container: @el.parents('.content')
load: @load
)
edit: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
channel = App.Channel.find(id)
new FormEdit(
channel: channel
container: @el.parents('.content')
load: @load
)
delete: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'Sure?'
callback: =>
@ajax(
id: 'cdr_signal_delete'
type: 'DELETE'
url: "#{@apiPath}/channels_cdr_signal"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
rotateToken: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'This will break the submission form!'
buttonSubmit: 'Reset token'
head: 'Reset the submission token?'
callback: =>
@ajax(
id: 'cdr_signal_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_signal_rotate_token"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
disable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_signal_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_signal_disable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
enable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_signal_enable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_signal_enable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
class FormAdd extends App.ControllerModal
head: 'Add Web Form'
shown: true
button: 'Add'
buttonCancel: true
small: true
content: ->
content = $(App.view('cdr_signal/form_add')())
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-select').on('click', (e) =>
@selectAll(e)
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(1)
content.find('.js-organization').replaceWith createOrgSelection(null)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
@ajax(
id: 'cdr_signal_app_verify'
type: 'POST'
url: "#{@apiPath}/channels_cdr_signal"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save Web Form.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
class FormEdit extends App.ControllerModal
head: 'Web Form Info'
shown: true
buttonCancel: true
content: ->
content = $(App.view('cdr_signal/form_edit')(channel: @channel))
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(@channel.group_id)
content.find('.js-organization').replaceWith createOrgSelection(@channel.options.organization_id)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
params = @formParams()
@channel.options = params
@ajax(
id: 'channel_cdr_signal_update'
type: 'PUT'
url: "#{@apiPath}/channels_cdr_signal/#{@channel.id}"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save changes.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
App.Config.set('cdr_signal', { prio: 5100, name: 'Signal', parent: '#channels', target: '#channels/cdr_signal', controller: Index, permission: ['admin.channel_cdr_signal'] }, 'NavBarAdmin')

View file

@ -0,0 +1,249 @@
class Index extends App.ControllerSubContent
requiredPermission: 'admin.channel_cdr_voice'
events:
'click .js-new': 'new'
'click .js-edit': 'edit'
'click .js-delete': 'delete'
'click .js-disable': 'disable'
'click .js-enable': 'enable'
'click .js-rotate-token': 'rotateToken'
constructor: ->
super
#@interval(@load, 60000)
@load()
load: =>
@startLoading()
@ajax(
id: 'cdr_voice_index'
type: 'GET'
url: "#{@apiPath}/channels_cdr_voice"
processData: true
success: (data) =>
@stopLoading()
App.Collection.loadAssets(data.assets)
@render(data)
)
render: (data) =>
channels = []
for channel_id in data.channel_ids
channel = App.Channel.find(channel_id)
if channel && channel.options
displayName = '-'
if channel.group_id
group = App.Group.find(channel.group_id)
displayName = group.displayName()
channel.options.groupName = displayName
channels.push channel
@html App.view('cdr_voice/index')(
channels: channels
)
new: (e) =>
e.preventDefault()
new FormAdd(
container: @el.parents('.content')
load: @load
)
edit: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
channel = App.Channel.find(id)
new FormEdit(
channel: channel
container: @el.parents('.content')
load: @load
)
delete: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'Sure?'
callback: =>
@ajax(
id: 'cdr_voice_delete'
type: 'DELETE'
url: "#{@apiPath}/channels_cdr_voice"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
rotateToken: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'This will break the submission form!'
buttonSubmit: 'Reset token'
head: 'Reset the submission token?'
callback: =>
@ajax(
id: 'cdr_voice_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_voice_rotate_token"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
disable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_voice_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_voice_disable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
enable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_voice_enable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_voice_enable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
class FormAdd extends App.ControllerModal
head: 'Add Web Form'
shown: true
button: 'Add'
buttonCancel: true
small: true
content: ->
content = $(App.view('cdr_voice/form_add')())
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-select').on('click', (e) =>
@selectAll(e)
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(1)
content.find('.js-organization').replaceWith createOrgSelection(null)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
@ajax(
id: 'cdr_voice_app_verify'
type: 'POST'
url: "#{@apiPath}/channels_cdr_voice"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save Web Form.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
class FormEdit extends App.ControllerModal
head: 'Web Form Info'
shown: true
buttonCancel: true
content: ->
content = $(App.view('cdr_voice/form_edit')(channel: @channel))
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(@channel.group_id)
content.find('.js-organization').replaceWith createOrgSelection(@channel.options.organization_id)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
params = @formParams()
@channel.options = params
@ajax(
id: 'channel_cdr_voice_update'
type: 'PUT'
url: "#{@apiPath}/channels_cdr_voice/#{@channel.id}"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save changes.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
App.Config.set('cdr_voice', { prio: 5100, name: 'Voice', parent: '#channels', target: '#channels/cdr_voice', controller: Index, permission: ['admin.channel_cdr_voice'] }, 'NavBarAdmin')

View file

@ -0,0 +1,249 @@
class Index extends App.ControllerSubContent
requiredPermission: 'admin.channel_cdr_whatsapp'
events:
'click .js-new': 'new'
'click .js-edit': 'edit'
'click .js-delete': 'delete'
'click .js-disable': 'disable'
'click .js-enable': 'enable'
'click .js-rotate-token': 'rotateToken'
constructor: ->
super
#@interval(@load, 60000)
@load()
load: =>
@startLoading()
@ajax(
id: 'cdr_whatsapp_index'
type: 'GET'
url: "#{@apiPath}/channels_cdr_whatsapp"
processData: true
success: (data) =>
@stopLoading()
App.Collection.loadAssets(data.assets)
@render(data)
)
render: (data) =>
channels = []
for channel_id in data.channel_ids
channel = App.Channel.find(channel_id)
if channel && channel.options
displayName = '-'
if channel.group_id
group = App.Group.find(channel.group_id)
displayName = group.displayName()
channel.options.groupName = displayName
channels.push channel
@html App.view('cdr_whatsapp/index')(
channels: channels
)
new: (e) =>
e.preventDefault()
new FormAdd(
container: @el.parents('.content')
load: @load
)
edit: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
channel = App.Channel.find(id)
new FormEdit(
channel: channel
container: @el.parents('.content')
load: @load
)
delete: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'Sure?'
callback: =>
@ajax(
id: 'cdr_whatsapp_delete'
type: 'DELETE'
url: "#{@apiPath}/channels_cdr_whatsapp"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
rotateToken: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
new App.ControllerConfirm(
message: 'This will break the submission form!'
buttonSubmit: 'Reset token'
head: 'Reset the submission token?'
callback: =>
@ajax(
id: 'cdr_whatsapp_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_whatsapp_rotate_token"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
container: @el.closest('.content')
)
disable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_whatsapp_disable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_whatsapp_disable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
enable: (e) =>
e.preventDefault()
id = $(e.target).closest('.action').data('id')
@ajax(
id: 'cdr_whatsapp_enable'
type: 'POST'
url: "#{@apiPath}/channels_cdr_whatsapp_enable"
data: JSON.stringify(id: id)
processData: true
success: =>
@load()
)
class FormAdd extends App.ControllerModal
head: 'Add Web Form'
shown: true
button: 'Add'
buttonCancel: true
small: true
content: ->
content = $(App.view('cdr_whatsapp/form_add')())
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-select').on('click', (e) =>
@selectAll(e)
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(1)
content.find('.js-organization').replaceWith createOrgSelection(null)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
@ajax(
id: 'cdr_whatsapp_app_verify'
type: 'POST'
url: "#{@apiPath}/channels_cdr_whatsapp"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save Web Form.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
class FormEdit extends App.ControllerModal
head: 'Web Form Info'
shown: true
buttonCancel: true
content: ->
content = $(App.view('cdr_whatsapp/form_edit')(channel: @channel))
createOrgSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'organization_id'
multiple: false
limit: 100
null: false
relation: 'Organization'
nulloption: true
value: selected_id
class: 'form-control--small'
)
createGroupSelection = (selected_id) ->
return App.UiElement.select.render(
name: 'group_id'
multiple: false
limit: 100
null: false
relation: 'Group'
nulloption: true
value: selected_id
class: 'form-control--small'
)
content.find('.js-messagesGroup').replaceWith createGroupSelection(@channel.group_id)
content.find('.js-organization').replaceWith createOrgSelection(@channel.options.organization_id)
content
onClosed: =>
return if !@isChanged
@isChanged = false
@load()
onSubmit: (e) =>
@formDisable(e)
params = @formParams()
@channel.options = params
@ajax(
id: 'channel_cdr_whatsapp_update'
type: 'PUT'
url: "#{@apiPath}/channels_cdr_whatsapp/#{@channel.id}"
data: JSON.stringify(@formParams())
processData: true
success: =>
@isChanged = true
@close()
error: (xhr) =>
data = JSON.parse(xhr.responseText)
@formEnable(e)
error_message = App.i18n.translateContent(data.error || 'Unable to save changes.')
@el.find('.alert').removeClass('hidden').text(error_message)
)
App.Config.set('cdr_whatsapp', { prio: 5100, name: 'Whatsapp', parent: '#channels', target: '#channels/cdr_whatsapp', controller: Index, permission: ['admin.channel_cdr_whatsapp'] }, 'NavBarAdmin')

View file

@ -0,0 +1,79 @@
class CdrSignalReply
@action: (actions, ticket, article, ui) ->
return actions if ui.permissionCheck('ticket.customer')
if article.sender.name is 'Customer' && article.type.name is 'cdr_signal'
actions.push {
name: 'reply'
type: 'cdrSignalMessageReply'
icon: 'reply'
href: '#'
}
actions
@perform: (articleContainer, type, ticket, article, ui) ->
return true if type isnt 'cdrSignalMessageReply'
ui.scrollToCompose()
# get reference article
type = App.TicketArticleType.find(article.type_id)
articleNew = {
to: ''
cc: ''
body: ''
in_reply_to: ''
}
if article.message_id
articleNew.in_reply_to = article.message_id
# get current body
articleNew.body = ui.el.closest('.ticketZoom').find('.article-add [data-name="body"]').html().trim() || ''
App.Event.trigger('ui::ticket::setArticleType', {
ticket: ticket
type: type
article: articleNew
position: 'end'
})
true
@articleTypes: (articleTypes, ticket, ui) ->
return articleTypes if !ui.permissionCheck('ticket.agent')
return articleTypes if !ticket || !ticket.create_article_type_id
articleTypeCreate = App.TicketArticleType.find(ticket.create_article_type_id).name
return articleTypes if articleTypeCreate isnt 'cdr_signal'
articleTypes.push {
name: 'cdr_signal'
icon: 'cdr-signal'
attributes: []
internal: false,
features: ['attachment']
maxTextLength: 10000
warningTextLength: 5000
}
articleTypes
@setArticleTypePost: (type, ticket, ui) ->
return if type isnt 'cdr_signal'
rawHTML = ui.$('[data-name=body]').html()
cleanHTML = App.Utils.htmlRemoveRichtext(rawHTML)
if cleanHTML && cleanHTML.html() != rawHTML
ui.$('[data-name=body]').html(cleanHTML)
@params: (type, params, ui) ->
if type is 'cdr_signal'
App.Utils.htmlRemoveRichtext(ui.$('[data-name=body]'), false)
params.content_type = 'text/plain'
params.body = App.Utils.html2text(params.body, true)
params
App.Config.set('300-CdrSignalReply', CdrSignalReply, 'TicketZoomArticleAction')

View file

@ -0,0 +1,79 @@
class CdrWhatsappReply
@action: (actions, ticket, article, ui) ->
return actions if ui.permissionCheck('ticket.customer')
if article.sender.name is 'Customer' && article.type.name is 'cdr_whatsapp'
actions.push {
name: 'reply'
type: 'cdrWhatsappMessageReply'
icon: 'reply'
href: '#'
}
actions
@perform: (articleContainer, type, ticket, article, ui) ->
return true if type isnt 'cdrWhatsappMessageReply'
ui.scrollToCompose()
# get reference article
type = App.TicketArticleType.find(article.type_id)
articleNew = {
to: ''
cc: ''
body: ''
in_reply_to: ''
}
if article.message_id
articleNew.in_reply_to = article.message_id
# get current body
articleNew.body = ui.el.closest('.ticketZoom').find('.article-add [data-name="body"]').html().trim() || ''
App.Event.trigger('ui::ticket::setArticleType', {
ticket: ticket
type: type
article: articleNew
position: 'end'
})
true
@articleTypes: (articleTypes, ticket, ui) ->
return articleTypes if !ui.permissionCheck('ticket.agent')
return articleTypes if !ticket || !ticket.create_article_type_id
articleTypeCreate = App.TicketArticleType.find(ticket.create_article_type_id).name
return articleTypes if articleTypeCreate isnt 'cdr_whatsapp'
articleTypes.push {
name: 'cdr_whatsapp'
icon: 'cdr-whatsapp'
attributes: []
internal: false,
features: ['attachment']
maxTextLength: 10000
warningTextLength: 5000
}
articleTypes
@setArticleTypePost: (type, ticket, ui) ->
return if type isnt 'cdr_whatsapp'
rawHTML = ui.$('[data-name=body]').html()
cleanHTML = App.Utils.htmlRemoveRichtext(rawHTML)
if cleanHTML && cleanHTML.html() != rawHTML
ui.$('[data-name=body]').html(cleanHTML)
@params: (type, params, ui) ->
if type is 'cdr_whatsapp'
App.Utils.htmlRemoveRichtext(ui.$('[data-name=body]'), false)
params.content_type = 'text/plain'
params.body = App.Utils.html2text(params.body, true)
params
App.Config.set('300-CdrWhatsappReply', CdrWhatsappReply, 'TicketZoomArticleAction')

View file

@ -0,0 +1,47 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Phone number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Token') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_token" type="text" name="bot_token" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Endpoint') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_endpoint" type="text" name="bot_endpoint" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which form submissions will get added to.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which submitters will be added to when they submit via this form.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,55 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Voice Line Number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="<%= @channel.options.phone_number %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Token') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_token" type="text" name="bot_token" value="<%= @channel.options.bot_token %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Endpoint') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_endpoint" type="text" name="bot_endpoint" value="<%= @channel.options.bot_endpoint %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which incoming messages will be added.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which users will be added to when they send a message to this number.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="token"><%- @T('Endpoint URL') %> <span>*</span></label>
</div>
<div class="controls">
<input id="token" type="text" value="<%= "#{App.Config.get('http_type')}://#{App.Config.get('fqdn')}/api/v1/channels_cdr_signal_webhook/#{@channel.options.token}" %>" class="form-control input js-select" readonly>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,49 @@
<div class="page-header">
<div class="page-header-title">
<h1><%- @T('Signal') %></h1>
</div>
<div class="page-header-meta">
<a class="btn btn--success js-new"><%- @T('Add Signal bot') %></a>
</div>
</div>
<div class="page-content">
<% if _.isEmpty(@channels): %>
<div class="page-description">
<p><%- @T('You have no configured %s right now.', 'Signal numbers') %></p>
</div>
<% else: %>
<% for channel in @channels: %>
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%= channel.id %>">
<div class="action-block action-row">
<h2><%- @Icon('status', 'supergood-color inline') %> <%= channel.options.phone_number %></h2>
</div>
<div class="action-flow action-flow--row">
<div class="action-block">
<h3><%- @T('Group') %></h3>
<% if channel.options: %>
<%= channel.options.groupName %>
<% end %>
</div>
<div class="action-block">
<h3><%- @T('Endpoint URL') %></h3>
<%- @T('Click the edit button to view the endpoint details ') %>
</div>
</div>
<div class="action-controls">
<div class="btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
<div class="btn btn--danger btn--secondary js-rotate-token"><%- @T('Reset Token') %></div>
<% if channel.active is true: %>
<div class="btn btn--secondary js-disable"><%- @T('Disable') %></div>
<% else: %>
<div class="btn btn--secondary js-enable"><%- @T('Enable') %></div>
<% end %>
<div class="btn js-edit"><%- @T('Edit') %></div>
</div>
</div>
<% end %>
</div>

View file

@ -0,0 +1,29 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Phone number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which form submissions will get added to.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which submitters will be added to when they submit via this form.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,37 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Voice Line Number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="<%= @channel.options.phone_number %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which incoming calls will be added to.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which users will be added to when they leave a recording to this voice line.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="token"><%- @T('Endpoint URL') %> <span>*</span></label>
</div>
<div class="controls">
<input id="token" type="text" value="<%= "#{App.Config.get('http_type')}://#{App.Config.get('fqdn')}/api/v1/channels_cdr_voice_webhook/#{@channel.options.token}" %>" class="form-control input js-select" readonly>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,49 @@
<div class="page-header">
<div class="page-header-title">
<h1><%- @T('Voice') %></h1>
</div>
<div class="page-header-meta">
<a class="btn btn--success js-new"><%- @T('Add Voice Line') %></a>
</div>
</div>
<div class="page-content">
<% if _.isEmpty(@channels): %>
<div class="page-description">
<p><%- @T('You have no configured %s right now.', 'voice lines') %></p>
</div>
<% else: %>
<% for channel in @channels: %>
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%= channel.id %>">
<div class="action-block action-row">
<h2><%- @Icon('status', 'supergood-color inline') %> <%= channel.options.phone_number %></h2>
</div>
<div class="action-flow action-flow--row">
<div class="action-block">
<h3><%- @T('Group') %></h3>
<% if channel.options: %>
<%= channel.options.groupName %>
<% end %>
</div>
<div class="action-block">
<h3><%- @T('Endpoint URL') %></h3>
<%- @T('Click the edit button to view the endpoint details ') %>
</div>
</div>
<div class="action-controls">
<div class="btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
<div class="btn btn--danger btn--secondary js-rotate-token"><%- @T('Reset Token') %></div>
<% if channel.active is true: %>
<div class="btn btn--secondary js-disable"><%- @T('Disable') %></div>
<% else: %>
<div class="btn btn--secondary js-enable"><%- @T('Enable') %></div>
<% end %>
<div class="btn js-edit"><%- @T('Edit') %></div>
</div>
</div>
<% end %>
</div>

View file

@ -0,0 +1,47 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Phone number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Token') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_token" type="text" name="bot_token" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Endpoint') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_endpoint" type="text" name="bot_endpoint" value="" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which form submissions will get added to.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which submitters will be added to when they submit via this form.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,55 @@
<div class="alert alert--danger hidden" role="alert"></div>
<fieldset>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Whatsapp Number') %> <span>*</span></label>
</div>
<div class="controls">
<input id="phone_number" type="text" name="phone_number" value="<%= @channel.options.phone_number %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Token') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_token" type="text" name="bot_token" value="<%= @channel.options.bot_token %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="form_name"><%- @T('Bot Endpoint') %> <span>*</span></label>
</div>
<div class="controls">
<input id="bot_endpoint" type="text" name="bot_endpoint" value="<%= @channel.options.bot_endpoint %>" class="form-control" required autocomplete="off">
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the group in which incoming messages will be added to.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="js-messagesGroup"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for=""><%- @T('Choose the organization to which users will be added to when they send a message to this number.') %> <span>*</span></label>
</div>
<div class="controls">
<div class="profile-organization js-organization"></div>
</div>
</div>
<div class="input form-group">
<div class="formGroup-label">
<label for="token"><%- @T('Endpoint URL') %> <span>*</span></label>
</div>
<div class="controls">
<input id="token" type="text" value="<%= "#{App.Config.get('http_type')}://#{App.Config.get('fqdn')}/api/v1/channels_cdr_whatsapp_webhook/#{@channel.options.token}" %>" class="form-control input js-select" readonly>
</div>
</div>
</fieldset>

View file

@ -0,0 +1,49 @@
<div class="page-header">
<div class="page-header-title">
<h1><%- @T('Whatsapp') %></h1>
</div>
<div class="page-header-meta">
<a class="btn btn--success js-new"><%- @T('Add Whatsapp bot') %></a>
</div>
</div>
<div class="page-content">
<% if _.isEmpty(@channels): %>
<div class="page-description">
<p><%- @T('You have no configured %s right now.', 'Whatsapp numbers') %></p>
</div>
<% else: %>
<% for channel in @channels: %>
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%= channel.id %>">
<div class="action-block action-row">
<h2><%- @Icon('status', 'supergood-color inline') %> <%= channel.options.phone_number %></h2>
</div>
<div class="action-flow action-flow--row">
<div class="action-block">
<h3><%- @T('Group') %></h3>
<% if channel.options: %>
<%= channel.options.groupName %>
<% end %>
</div>
<div class="action-block">
<h3><%- @T('Endpoint URL') %></h3>
<%- @T('Click the edit button to view the endpoint details ') %>
</div>
</div>
<div class="action-controls">
<div class="btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
<div class="btn btn--danger btn--secondary js-rotate-token"><%- @T('Reset Token') %></div>
<% if channel.active is true: %>
<div class="btn btn--secondary js-disable"><%- @T('Disable') %></div>
<% else: %>
<div class="btn btn--secondary js-enable"><%- @T('Enable') %></div>
<% end %>
<div class="btn js-edit"><%- @T('Edit') %></div>
</div>
</div>
<% end %>
</div>

View file

@ -0,0 +1,4 @@
.icon-cdr-signal {
width: 17px;
height: 17px;
}

View file

@ -0,0 +1,4 @@
.icon-cdr-whatsapp {
width: 17px;
height: 17px;
}