Action.Submit Not firing an event / action in the server - microsoft-teams

I have a problem that when creating a message on a private channel, the Action.Submit button is not firing an event in the server whoever it works perfectly if the message is not private.
this.onBegin(async (session, args, next) => {
await this.onDialogBegin(session, args, next)
});
this.onDefault(async (session) => {
await this.onMessageReceived(session);
});
Chatbot private screen. The ok button not triggering an action
'type' => 'Action.ShowCard',
'title' => 'Update ticket',
'card' => [
'type' => 'AdaptiveCard',
'body' => [
[
'type' => 'Input.Text',
'id' => 'summary',
'value' => $this->connectWiseTicket->summary,
'placeholder' => 'Summary'
],
],
'actions' => [
[
'type' => 'Action.Submit',
'title' => 'OK',
'data' => [
'action' => 'update_ticket',
'ticketID' => $ticket->id,
'type' => 'form_submit'
]
]
]
]

Related

How to add spinner to select list using ajax programmatically?

I want to add spinner to select list using ajax. I have tried below code for throbber but it's not working for select list.
$form['select choice'] = [
'#type' => 'select',
'#title' => t('Choice'),
'#attributes' => [
'class' => ['js-dop-chosen'],
],
'#options' => [
'---' => t('None'),
t('choice 1'),
t('choice 2'),
],
'#ajax' => [
'event' => 'change',
'wrapper' => 'form-wrapper',
'callback' => [$this, 'ajaxCallback'],
'progress' => [
'type' => 'throbber',
'message' => 'fetching content.....',
],
],
];

pwa Laravel don't give me error in console but error in service workers in Cache

this first time to make PWA, I make everything like https://github.com/silviolleite/laravel-pwa and all thing is good in console but make error in manifest and service workers
my path project is :
_config
|_laravelpwa.php
_resources
|_views
|_vendor
|_laravelpwa
|_meta.blade.php
_index.php
_serviceworker.js
meta.blade.php all same expect
<script type="text/javascript">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '.'
}).then(function (registration) {
// Registration was successful
console.log('Laravel PWA: ServiceWorker registration successful with scope: ', registration.scope);
}, function (err) {
// registration failed :(
console.log('Laravel PWA: ServiceWorker registration failed: ', err);
});
}
</script>
laravelpwa.php
<?php
return [
'name' => 'baskotii',
'manifest' => [
'name' => 'baskotii',
'short_name' => 'baskotii',
'start_url' => '/',
'background_color' => '#ffffff',
'theme_color' => '#000000',
'display' => 'standalone',
'orientation'=> 'any',
'status_bar'=> 'black',
'icons' => [
'72x72' => [
'path' => asset('assets/front/img/logo72.png'),
'purpose' => 'any'
],
'96x96' => [
'path' => '/public/images/icons/icon-96x96.png',//asset('assets/front/img/logo96.png'),
'purpose' => 'any'
],
'128x128' => [
'path' => asset('assets/front/img/logo128.png'),
'purpose' => 'any'
],
'144x144' => [
'path' => asset('assets/front/img/logo144.png'),
'purpose' => 'any'
],
'152x152' => [
'path' => asset('assets/front/img/logo152.png'),
'purpose' => 'any'
],
'192x192' => [
'path' => asset('assets/front/img/logo192.png'),
'purpose' => 'any'
],
'384x384' => [
'path' => asset('assets/front/img/logo384.png'),
'purpose' => 'any'
],
'512x512' => [
'path' => asset('assets/front/img/logo512.png'),
'purpose' => 'any'
],
],
'splash' => [
'640x1136' => '/images/icons/splash-640x1136.png',
'750x1334' => '/images/icons/splash-750x1334.png',
'828x1792' => '/images/icons/splash-828x1792.png',
'1125x2436' => '/images/icons/splash-1125x2436.png',
'1242x2208' => '/images/icons/splash-1242x2208.png',
'1242x2688' => '/images/icons/splash-1242x2688.png',
'1536x2048' => '/images/icons/splash-1536x2048.png',
'1668x2224' => '/images/icons/splash-1668x2224.png',
'1668x2388' => '/images/icons/splash-1668x2388.png',
'2048x2732' => '/images/icons/splash-2048x2732.png',
],
'shortcuts' => [
[
'name' => 'baskotii',
'description' => 'baskotii',
'url' => '/',
'icons' => [
"src" => '/public/images/icons/icon-96x96.png',
"purpose" => "any"
]
]
],
'custom' => []
]
];
I use my img and default img and make the same warning
the Result:
console
Laravel PWA: ServiceWorker registration successful with scope: https://baskotii.ae/
and this in serviceworker.js:1
Uncaught (in promise) TypeError: Failed to execute 'Cache' on 'addAll': Request failed
manifest warning
service workers error
Try with update URL in serviceworker.js
Like this
var filesToCache = [
'css/app.css',
'js/app.js',
'images/icons/icon-72x72.png',
'images/icons/icon-96x96.png',
'images/icons/icon-128x128.png',
'images/icons/icon-144x144.png',
'images/icons/icon-152x152.png',
'images/icons/icon-192x192.png',
'images/icons/icon-384x384.png',
'images/icons/icon-512x512.png',
];

Proper formatting of a JSON and multiplepart Guzzle post request

I have two different Guzzle post requests that I am trying to merge (solely because they basically do a united job and should be performed together).
Initially I have my donation data:
'donation' => [
'web_id' => $donation->web_id,
'amount' => $donation->amount,
'type' => $donation->type,
'date' => $donation->date->format('Y-m-d'),
'collection_id' => NULL,
'status_id' => $donation->status_id,
],
And then I have my files that go with it, which are basically two different PDFs that are enabled or disabled for donors, sometimes they have both. I know the multipart would look something like below, but I'm not sure.
foreach ($uploadDocs as $doc) {
'multipart' => [
[
'name' => 'donation_id',
'contents' => $donation->web_id,
],
[
'name' => 'type_id',
'contents' => $doc->type_id',
],
[
'name' => 'file',
'contents' => fopen($doc->path, 'r'),
'headers' => ['Content-Type' => 'application/pdf'],
],
],
}
Since I've usually only handled one file at a time and I'm not sure how to merge the first block of code with the second for an appropriate Guzzle post request.
You can try this:
$donationData = [
'web_id' => $donation->web_id,
'amount' => $donation->amount,
'type' => $donation->type,
'date' => $donation->date->format('Y-m-d'),
'collection_id' => NULL,
'status_id' => $donation->status_id,
];
$multipart = [];
foreach ($uploadDocs as $doc) {
$multipart[] = [
[
'name' => 'donation_id',
'contents' => $donation->web_id,
],
[
'name' => 'type_id',
'contents' => $doc->type_id,
],
[
'name' => 'file',
'contents' => fopen($doc->path, 'r'),
'headers' => ['Content-Type' => 'application/pdf'],
],
];
}
Than perform your request:
$r = $client->request('POST', 'http://example.com', [
'body' => $donationData,
'multipart' => $multipart,
]);

Cakephp different sessions for different users

I have cakephp application which has two separate logins one for admin and one for employee. I am using session to store login details.but when i logged out from admin it automatically logouts from employee and vice versa. can i use two different sessions for that?
I am not using role based login. Instead i am using plugin for admin
admin App Controller
$this->loadComponent('Auth', [
'loginAction' => ['controller' => 'Users', 'action' => 'login'],
'logoutRedirect' => [
'controller' => 'Users',
'action' => 'login',
],
'authenticate' => [
'Form' => [
'userModel' => 'Users',
'fields' => ['username' => 'username', 'password' => 'password']
]
],
'authError' => 'Enter Credentials',
'storage' => 'Session',
'unauthorizedRedirect' => false
]
);
Employee App controller
$this->loadComponent('Auth', [
'loginAction' => [
'controller' => 'Employees',
'action' => 'loginemp'
],
'logoutRedirect' => [
'controller' => 'Employees',
'action' => 'loginemp',
],
'authError' => 'Enter Credentials',
'authenticate' => [
'Form' => [
'userModel' => 'Employees',
'fields' => ['username' => 'username', 'password' => 'password']
]
],
'storage' => 'Session',
'unauthorizedRedirect' => false
]);
Change
'storage' => 'Session'
to
'storage' => [ // Add this array
'className' => 'Session',
'key' => 'Auth.Admin',
],
in your admin panel Auth cofiguration.
For e.g. Assuming below admin panel Auth configuration:
$this->loadComponent('Auth', [
'loginAction' => ['controller' => 'Users', 'action' => 'login'],
'logoutRedirect' => [
'controller' => 'Users',
'action' => 'login',
],
'authenticate' => [
'Form' => [
'userModel' => 'Users',
'fields' => ['username' => 'username', 'password' => 'password']
]
],
'authError' => 'Enter Credentials',
'storage' => [ // Change this
'className' => 'Session',
'key' => 'Auth.Admin',
],
'unauthorizedRedirect' => false
]
);

How to always show single validation message in ZF2 validators?

I have the following input:
private function addBirthdayElement()
{
return $this->add(
array(
'type' => 'DateSelect',
'name' => 'x_bdate',
'options' => [
'label' => 'astropay_birthday',
'label_attributes' => array(
'class' => 'astropay-label'
),
'create_empty_option' => true,
'render_delimiters' => false,
],
'attributes' => array(
'required' => true,
'class' => 'astropay-input',
)
)
);
}
It has the following filter:
public function addBirthdayFilter()
{
$time = new \DateTime('now');
$eighteenYearAgo = $time->modify(sprintf('-%d year', self::EIGHTEEN_YEARS))->format('Y-m-d');
$this->add(
[
'name' => 'x_bdate',
'required' => true,
'validators' => [
[
'name' => 'Between',
'break_chain_on_failure' => true,
'options' => [
'min' => 1900,
'max' => $eighteenYearAgo,
'messages' => [
Between::NOT_BETWEEN => 'astropay_invalid_birth_date_18',
Between::NOT_BETWEEN_STRICT => 'astropay_invalid_birth_date_18',
]
]
],
[
'name' => 'Date',
'break_chain_on_failure' => true,
'options' => [
'messages' => [
Date::INVALID => 'astropay_invalid_birth_date',
Date::FALSEFORMAT => 'astropay_invalid_birth_date',
Date::INVALID_DATE => 'astropay_invalid_birth_date',
],
]
],
],
]
);
return $this;
}
However, putting an empty date, I get the error message defined for:
Date::INVALID_DATE
But it's not the overridden one. The break_chain_on_failure works for the two validators I have defined, but the default Zend message is always there. For example I get this as an error in my form:
The input does not appear to be a valid date
astropay_invalid_birth_date_18
How can I display only the overidden error messages and 1 at a time?
You can use a message key in your validator configuration instead of a messages array to always show a single message per validator.
For example, replace this:
'options' => [
'messages' => [
Date::INVALID => 'astropay_invalid_birth_date',
Date::FALSEFORMAT => 'astropay_invalid_birth_date',
Date::INVALID_DATE => 'astropay_invalid_birth_date',
],
]
with this one:
'options' => [
'message' => 'Invalid birth date given!',
]

Resources