You are on page 1of 7

<h2>Your seat reservations</h2>

<table>
<thead><tr>
<th>Passenger name</th><th>Meal</th><th>Surcharge</th><th></th>
</tr></thead>
<!-- Todo: Generate table body -->
<tbody data-bind="foreach: seats">
<tr>
<td><input data-bind="value: name" /></td>
<td><select data-bind="options: $root.availableMeals, value: meal,
optionsText: 'mealName'"></select></td>
<td data-bind="text: meal().price"></td>
</tr>
<button data-bind="click: addSeat">Another Seat</button>
</tbody>
</table>d

// Class to represent a row in the seat reservations grid


function SeatReservation(name, initialMeal) {
var self = this;
self.name = name;
self.meal = ko.observable(initialMeal);
}

// Overall viewmodel for this screen, along with initial state


function ReservationsViewModel() {
var self = this;

// Non-editable catalog data - would come from the server


self.availableMeals = [
{ mealName: "Standard (sandwich)", price: 0 },
{ mealName: "Premium (lobster)", price: 34.95 },
{ mealName: "Ultimate (whole zebra)", price: 290 },
{ mealName: "Soup", price: 15}
];

// Editable data
self.seats = ko.observableArray([
new SeatReservation("Steve", self.availableMeals[1]),
new SeatReservation("Bert", self.availableMeals[2]),
new SeatReservation("Arsen", self.availableMeals[3])
]);

self.addSeat = function(){
self.seats.push(new SeatReservation("Max",self.availableMeals[0]));

ko.applyBindings(new ReservationsViewModel());
//declare(strict_types=1);
//
//namespace ArseniyInk\Ctrl\Observer;
//
//class ProcessFinalPriceObserver implements \Magento\Framework\Event\
ObserverInterface
//{
// public function execute(\Magento\Framework\Event\Observer $observer)
// {
// $price = $observer->getData('product');
// $price->setFinalPrice(12.00);
// var_dump($price);
// echo $price;
// return $this;
// }
//}

<!-- <event name="catalog_product_get_final_price">-->


<!-- <observer name="product" instance="ArseniyInk\Ctrl\Observer\
ProcessFinalPriceObserver" />-->
<!-- </event>-->

Message q +
Identity interface і cache +
Acl +
Resorses webapi +
Systems xml +
Node field +
Як показати що один модуль має йти за іншим +
Mysql engine +
Mysqlidex +
Db shema +
Db write list +
Ще форінкей +
Як перенести дані з одної таблиці в іншу при дропі db shema xml +
Singleton +
Task 2

1. +/-(+)
2. +/-(+)
3. +/-
4. +

<?php
declare(strict_types=1);

namespace ArseniyInk\Clients\Controller\Clients;

use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\View\Result\Page;

class Profile extends \Magento\Framework\App\Action\Action


{

const LOGIN_PATH = 'arseniyinkclients/clients/login';

protected $messageManager;
protected $postModel;
protected $postResorceModel;

public function __construct(


\ArseniyInk\Clients\Model\ClientsTableFactory $postModel,
\ArseniyInk\Clients\Model\ResourceModel\ClientsTable $postResorceModel,
\ArseniyInk\ClientsOld\Model\ResourceModel\ClientsTable\CollectionFactory
$postCollection,
\Magento\Framework\App\Action\Context $context,
ResultFactory $resultFactory)
{

$this->postModel = $postModel;
$this->postResorceModel = $postResorceModel;
$this->postCollection = $postCollection;
return parent::__construct($context);
}

public function execute()


{
/** @var Page $page */
$page = $this->resultFactory->create(ResultFactory::TYPE_PAGE);

$postData = $this->getRequest()->getPostValue();
if (!$this->isRowExists($postData)) {
$this->messageManager->addNoticeMessage(
__('This user is not found in DB!')
);

$redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirect->setPath(self::LOGIN_PATH);

return $redirect;
} else {

return $page;

// public function isDataPresent($data)


// {
// if (isset($data['username']) && $data['username'] != '') {
// return true;
// }
//
// return false;
//
// }
public function isRowExists(array $data): bool
{
if ($data['username'] && $data['password']) {
/** @var Collection $posts */
$posts = $this->postCollection->create();
$posts->addFieldToSelect(['username', 'password'])
->addFieldToFilter('username',$data['username'])
->addFieldToFilter('password', $data['password']);

return (bool)$posts->getSize();
}

. '<div class="field field-name-lastname required">


<label class="label" for="lastname">
<span>Count Rooms</span>
</label>

<div class="control">
<input type="text" id="lastname"
name="lastname"
value=""
title="Count Rooms"
class="input-text required-entry" data-
validate="{required:true}">
</div>
</div>'

return false;
}
}

<!--<?xml version="1.0" ?>-->


<!--<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.x
sd">-->
<!-- <fieldset name="general">-->
<!-- <field name="short_description_attribute">-->
<!-- <argument name="data" xsi:type="array">-->
<!-- <item name="config" xsi:type="array">-->
<!-- <item name="required" xsi:type="boolean">false</item>-->
<!-- <item name="validation" xsi:type="array">-->
<!-- <item name="required-entry"
xsi:type="boolean">false</item>-->
<!-- </item>-->
<!-- <item name="sortOrder" xsi:type="number">333</item>-->
<!-- <item name="dataType" xsi:type="string">string</item>-->
<!-- <item name="formElement" xsi:type="string">input</item>-->
<!-- <item name="label" translate="true" xsi:type="string">Short
Description</item>-->
<!-- </item>-->
<!-- </argument>-->
<!-- </field>-->
<!-- <field name="test_short_description_attribute">-->
<!-- <argument name="data" xsi:type="array">-->
<!-- <item name="config" xsi:type="array">-->
<!-- <item name="required" xsi:type="boolean">false</item>-->
<!-- <item name="validation" xsi:type="array">-->
<!-- <item name="required-entry"
xsi:type="boolean">false</item>-->
<!-- </item>-->
<!-- <item name="sortOrder" xsi:type="number">334</item>-->
<!-- <item name="dataType" xsi:type="string">string</item>-->
<!-- <item name="formElement" xsi:type="string">input</item>-->
<!-- <item name="label" translate="true"
xsi:type="string">NShort Description</item>-->
<!-- </item>-->
<!-- </argument>-->
<!-- </field>-->
<!-- </fieldset>-->

<?php
/** @var \ArseniyInk\TaskTwo\Block\Index $block */
$options = $block->getOptions();
?>
<div class="insurance">
<label for="new_test_product_insurance_attribute"><strong><?=
__('Insurance'); ?></strong></label>
<select name="new_test_product_insurance_attribute"
id="new_test_product_insurance_attribute">
<?php foreach ($options as $option): ?>
<option value="<?= $option['value']; ?>"><?= $option['label'];
?></option>
<?php endforeach; ?>
</select>
</div>
<br/>

<!--</form>-->

You might also like