mirror of
https://github.com/Karaka-Management/oms-Messages.git
synced 2026-01-11 08:38:40 +00:00
fix tests
This commit is contained in:
parent
ff3ed81b4a
commit
15a95fb389
|
|
@ -48,37 +48,11 @@ final class ApiController extends Controller
|
|||
*/
|
||||
public function apiEmailCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateEmailCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$email = $this->createEmailFromRequest($request);
|
||||
$this->createModel($request->header->account, $email, EmailMapper::class, 'email', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $email);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate email create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateEmailCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['subject'] = !$request->hasData('subject'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create email from request.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
<div class="tab-content">
|
||||
<?php foreach ($mail->l11n as $idx => $l11n) : ?>
|
||||
<input type="radio" id="c-tab-<?= $idx; ?>" name="tabular-1" checked>
|
||||
<input type="radio" id="c-tab-<?= $idx; ?>" name="tabular-1"<?= $l11n === $this->response->header->l11n->language ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
|
|
|||
|
|
@ -14,14 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/*
|
||||
$mail = new \phpOMS\Message\Mail\Imap();
|
||||
$mail->connect('{imap.gmail.com:993/imap/ssl}INBOX', 'dev.orange.management@gmail.com', 'DEV_PASSWORD');
|
||||
$unseen = $mail->getInboxUnseen();
|
||||
$seen = $mail->getInboxSeen();
|
||||
$quota = $mail->getQuota();
|
||||
*/
|
||||
|
||||
$messages = $this->data['templates'] ?? [];
|
||||
|
||||
$previous = empty($messages) ? 'messages/dashboard' : 'messages/dashboard?{?}&id=' . \reset($messages)->id . '&ptype=p';
|
||||
|
|
@ -34,29 +26,29 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Templates'); ?><i class="lni lni-download download btn end-xs"></i></div>
|
||||
<table id="profileList" class="default">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><span class="check"><input type="checkbox" name="profile-list"></span>
|
||||
<td class="wf-100"><?= $this->getHtml('Subject'); ?>
|
||||
<td><?= $this->getHtml('Date'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($messages as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/messages/template/single?{?}&id=' . $value->id); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><span class="check"><input type="checkbox" name=""></span>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml(empty($value->subject) ? $value->getL11nByLanguage($this->response->header->l11n->language)->subject : $value->subject); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr>
|
||||
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td><span class="check"><input type="checkbox" name="profile-list"></span>
|
||||
<td class="wf-100"><?= $this->getHtml('Subject'); ?>
|
||||
<td><?= $this->getHtml('Date'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($messages as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/messages/template/single?{?}&id=' . $value->id); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><span class="check"><input type="checkbox" name=""></span>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml(empty($value->subject) ? $value->getL11nByLanguage($this->response->header->l11n->language)->subject : $value->subject); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr>
|
||||
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user