v.2.24
1. POSTBonus in/out 2. POSTPresale in/out 3. Переработана форма гостя
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class ClientGroup extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getclientgroup';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup;
|
||||
$group->code = '0';
|
||||
$group->name = 'Без группы';
|
||||
$group->save();
|
||||
}
|
||||
$client_groups = ClientsGroup::orderBy('code')->get();
|
||||
foreach ($client_groups as $client_group) {
|
||||
$out[] = array('id' => $client_group['id'], 'name' => $client_group['name']);
|
||||
}
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->where('work_code', '=', 1)->first();
|
||||
$dir = __DIR__ . "/../../../Exchange/" . $terminal['key'] . "/";
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir, 0755, 'w+');
|
||||
}
|
||||
|
||||
$files = glob($dir . "*.*");
|
||||
if (count($files) > 0) {
|
||||
usort($files, function ($a, $b) {
|
||||
return filemtime($a) < filemtime($b);
|
||||
});
|
||||
|
||||
foreach ($files as $plk2) {
|
||||
$file_array[] = str_replace($dir, '', $plk2);
|
||||
}
|
||||
$filename = $file_array['0'];
|
||||
$file = date("d.m.Y H:i:s", filemtime(__DIR__ . "/../../../Exchange/" . $terminal['key'] . "/" . $file_array['0']));
|
||||
} else {
|
||||
$file_array = '';
|
||||
$filename = '';
|
||||
$file = '';
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'groups' => $out,
|
||||
'terminalKey' => $terminal['key'],
|
||||
'files' => $files,
|
||||
'filename' => $filename,
|
||||
'filedate' => $file,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Clients extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getclients';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup([
|
||||
'code' => '0',
|
||||
'name' => 'Без группы',
|
||||
]);
|
||||
$group->save();
|
||||
}
|
||||
$countPerPage = 25;
|
||||
$offset = ($input['page'] - 1) * $countPerPage;
|
||||
if ($input['group_id'] == 0) {
|
||||
$group = ClientsGroup::where('code', '=', $input['group_id'])->first();
|
||||
} else {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
}
|
||||
$clients = Client::where('group_id', '=', $group['code'])->skip($offset)->take($countPerPage)->get();
|
||||
$total = Client::where('group_id', '=', $group['code'])->count();
|
||||
if ($total == NULL) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => array(),
|
||||
'total' => 0,
|
||||
'size' => $countPerPage,
|
||||
'pages' => 1,
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
} else {
|
||||
|
||||
foreach ($clients as $client) {
|
||||
$phone = ClientsPhone::where('client_guid', '=', $client['user_code'])->first();
|
||||
$out[] = array('id' => $client['id'], 'name' => $client['name'], 'phone' => $phone['phone']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => $out,
|
||||
'total' => $total,
|
||||
'size' => $countPerPage,
|
||||
'pages' => ceil($total / $countPerPage),
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ use App\Component\Models\Tasks;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Bot extends HRCCommand implements HRCCommandInterface
|
||||
class GETBot extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getbot';
|
||||
|
||||
@@ -7,7 +7,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class ClientFile extends HRCCommand implements HRCCommandInterface {
|
||||
class GETClientFile extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getclientfile';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
58
commands/GETClientInfo.php
Normal file
58
commands/GETClientInfo.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientInfo extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientinfo';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$phone = Client::getPhone($client_guid);
|
||||
$address = Client::getAddress($client_guid);
|
||||
$email = Client::getEmail($client_guid);
|
||||
$presale = ClientsPresale::getPresale($client_guid);
|
||||
$bonus = ClientsBonus::getBonus($client_guid);
|
||||
$orders_count_exchange = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->count();
|
||||
$orders_count_current = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->count();
|
||||
$orders_sum_exchange = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->sum('full_sum');
|
||||
$orders_sum_current = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->sum('full_sum');
|
||||
$orders_count = $orders_count_exchange + $orders_count_current;
|
||||
$orders_sum = $orders_sum_exchange + $orders_sum_current;
|
||||
$result = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'info' => array(
|
||||
'phone' => $phone,
|
||||
'email' => $email,
|
||||
'address' => $address,
|
||||
'order_count' => $orders_count,
|
||||
'order_sum' => $orders_sum,
|
||||
'presale' => $presale,
|
||||
'bonus' => intval($bonus),
|
||||
)
|
||||
);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $result,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
51
commands/GETClientLog.php
Normal file
51
commands/GETClientLog.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsActions;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientLog extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientlog';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$logs = ClientsActions::where('user_id', $client_guid)->orderByDesc('created')->get();
|
||||
$info = [];
|
||||
foreach ($logs as $log) {
|
||||
$info[] = array(
|
||||
'action' => $log['action'],
|
||||
'value' => round($log['action_value'], 2),
|
||||
'who' => Staff::getName($log['who']),
|
||||
'time' => $log['created'],
|
||||
'type' => $log['action_type']
|
||||
);
|
||||
}
|
||||
$result = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'info' => $info
|
||||
);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $result,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
commands/GETClientOrderInfo.php
Normal file
34
commands/GETClientOrderInfo.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientOrderInfo extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientorderinfo';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$order_id = $input['order_id'];
|
||||
$opened = urldecode($input['opened']);
|
||||
$closed = urldecode($input['closed']);
|
||||
$shift = ShiftOnlineOrders::orderBy('opened', 'asc')->first();
|
||||
if ($shift['opened'] > $opened) {
|
||||
$order = ExchangeOrders::where('opened', $opened)->where('closed', $closed)->where('code', $order_id)->first();
|
||||
$shift_id = $order['shift_id'];
|
||||
$info = ExchangeOrders::getInfo($order_id, $shift_id);
|
||||
} else {
|
||||
$info = ShiftOnlineOrders::getInfo($order_id);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'info' => $info[0],
|
||||
];
|
||||
}
|
||||
}
|
||||
54
commands/GETClientOrders.php
Normal file
54
commands/GETClientOrders.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientOrders extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientorders';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$exchange_orders = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->orderByDesc('closed')->get();
|
||||
$online_orders = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->orderByDesc('closed')->get();
|
||||
$orders = [];
|
||||
foreach ($online_orders as $online_order) {
|
||||
$orders[] = array(
|
||||
'id' => $online_order['code'],
|
||||
'opened' => $online_order['opened'],
|
||||
'closed' => $online_order['closed'],
|
||||
'sum' => $online_order['order_sum'],
|
||||
'discount' => $online_order['sale_sum'],
|
||||
'shift_id' => 0
|
||||
);
|
||||
}
|
||||
foreach ($exchange_orders as $exchange_order) {
|
||||
$orders[] = array(
|
||||
'id' => $exchange_order['code'],
|
||||
'opened' => $exchange_order['opened'],
|
||||
'closed' => $exchange_order['closed'],
|
||||
'sum' => $exchange_order['order_sum'],
|
||||
'discount' => $exchange_order['sale_sum'],
|
||||
'shift_id' => $exchange_order['shift_id']
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'orders' => $orders,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
166
commands/GETClients.php
Normal file
166
commands/GETClients.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsBarcode;
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Component\Models\ClientsEmail;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETClients extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclients';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['type']) && $input['type'] == 'loyalty') {
|
||||
$last_update = Carbon::createFromTimestampUTC($input['last_update'])->timezone('Europe/Minsk');
|
||||
$phones = ClientsPhone::where('updated_at', '>=', $last_update)->get();
|
||||
$addresses = ClientsAddress::where('updated_at', '>=', $last_update)->get();
|
||||
$barcodes = ClientsBarcode::where('updated_at', '>=', $last_update)->get();
|
||||
$emails = ClientsEmail::where('updated_at', '>=', $last_update)->get();
|
||||
$presales = ClientsPresale::where('updated_at', '>=', $last_update)->get();
|
||||
$bonuses = ClientsBonus::where('updated_at', '>=', $last_update)->get();
|
||||
$clients = Client::where('updated_at', '>=', $last_update)->get();
|
||||
$info = [];
|
||||
foreach ($phones as $phone) {
|
||||
$info[] = $phone['client_guid'];
|
||||
}
|
||||
foreach ($addresses as $address) {
|
||||
$info[] = $address['client_guid'];
|
||||
}
|
||||
foreach ($barcodes as $barcode) {
|
||||
$info[] = $barcode['client_guid'];
|
||||
}
|
||||
foreach ($emails as $email) {
|
||||
$info[] = $email['client_guid'];
|
||||
}
|
||||
foreach ($presales as $presale) {
|
||||
$info[] = $presale['client_guid'];
|
||||
}
|
||||
foreach ($bonuses as $bonus) {
|
||||
$info[] = $bonus['client_guid'];
|
||||
}
|
||||
foreach ($clients as $client) {
|
||||
$info[] = $client['user_code'];
|
||||
}
|
||||
$guides = array_values(array_unique($info));
|
||||
$email = $phone = $client = [];
|
||||
foreach ($guides as $guid) {
|
||||
$email_address = Client::getEmail($guid);
|
||||
$phone_number = Client::getPhone($guid);
|
||||
$client_info = Client::where('user_code', $guid)->first();
|
||||
$email[] = array(
|
||||
'email' => $email_address
|
||||
);
|
||||
$phone[] = array(
|
||||
'phone' => $phone_number
|
||||
);
|
||||
$badge[] = array(
|
||||
'name' => 'Test',
|
||||
'code' => 1
|
||||
);
|
||||
$bonus_dishes[] = array(
|
||||
'code' => ''
|
||||
);
|
||||
if (ClientsBonus::getBonus($guid) > 0) {
|
||||
$bonus_info[] = array(
|
||||
'amount' => ClientsBonus::getBonus($guid),
|
||||
'dishes' => $bonus_dishes
|
||||
);
|
||||
} else {
|
||||
$bonus_info[] = array(
|
||||
'amount' => ClientsBonus::getBonus($guid)
|
||||
);
|
||||
}
|
||||
|
||||
$group_info = ClientsGroup::where('code', $client_info['group_id'])->first();
|
||||
$client[] = array(
|
||||
'id' => $client_info['id'],
|
||||
'name' => $client_info['name'],
|
||||
'guid' => $guid,
|
||||
'presale' => ClientsPresale::getPresale($guid),
|
||||
'bonuses' => $bonus_info,
|
||||
'barcode' => Client::getBarcode($guid),
|
||||
'group_id' => $client_info['group_id'],
|
||||
'emails' => $email,
|
||||
'phones' => $phone,
|
||||
'badges' => $badge
|
||||
);
|
||||
$groups[] = $group_info['code'];
|
||||
$email = $phone = $badge = $bonus_dishes = $bonus_info = [];
|
||||
}
|
||||
$groups_guides = array_values(array_unique($groups));
|
||||
foreach ($groups_guides as $group) {
|
||||
$group_info = ClientsGroup::where('code', $group)->first();
|
||||
$groups_info[] = array(
|
||||
'id' => $group_info['id'],
|
||||
'name' => $group_info['name'],
|
||||
'guid' => $group_info['code'],
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => $client,
|
||||
'groups' => $groups_info,
|
||||
];
|
||||
}
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup([
|
||||
'code' => '0',
|
||||
'name' => 'Без группы',
|
||||
]);
|
||||
$group->save();
|
||||
}
|
||||
$countPerPage = 25;
|
||||
$offset = ($input['page'] - 1) * $countPerPage;
|
||||
if ($input['group_id'] == 0) {
|
||||
$group = ClientsGroup::where('code', '=', $input['group_id'])->first();
|
||||
} else {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
}
|
||||
$clients = Client::where('group_id', '=', $group['code'])->skip($offset)->take($countPerPage)->get();
|
||||
$total = Client::where('group_id', '=', $group['code'])->count();
|
||||
if ($total == NULL) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => array(),
|
||||
'total' => 0,
|
||||
'size' => $countPerPage,
|
||||
'pages' => 1,
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
} else {
|
||||
|
||||
foreach ($clients as $client) {
|
||||
$phone = Client::getPhone($client['user_code']);
|
||||
$email = Client::getEmail($client['user_code']);
|
||||
$address = Client::getAddress($client['user_code']);
|
||||
$out[] = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'phone' => $phone,
|
||||
'email' => $email,
|
||||
'address' => $address,
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => $out,
|
||||
'total' => $total,
|
||||
'size' => $countPerPage,
|
||||
'pages' => ceil($total / $countPerPage),
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,8 @@ class GETDiscountItems extends HRCCommand implements HRCCommandInterface {
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$dish = Dishes::where('code', $item['dish_code'])->where('is_history', 0)->first();
|
||||
if (!isset($dish)) {
|
||||
$dish = Dishes::where('legacy_code', $item['dish_code'])->where('is_history', 0)->first();
|
||||
}
|
||||
$items[] = array('name' => $dish['name'], 'discount' => round($discount, 0), 'count' => $item['count'], 'sale_price' => $salePrice, 'sum' => round($realPrice, 2));
|
||||
$dish = Dishes::getName($item['menu_code']);
|
||||
$items[] = array('name' => $dish, 'discount' => round($discount, 0), 'count' => $item['count'], 'sale_price' => $salePrice, 'sum' => round($realPrice, 2));
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -8,7 +8,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Equipment extends HRCCommand implements HRCCommandInterface {
|
||||
class GETEquipment extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getequipment';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -6,7 +6,7 @@ use App\Component\Models\User;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class HelloWorld extends HRCCommand implements HRCCommandInterface {
|
||||
class GETHelloWorld extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gethello';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -6,7 +6,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Import extends HRCCommand implements HRCCommandInterface {
|
||||
class GETImport extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getimport';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -9,93 +9,92 @@ use App\Component\Models\Staff;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOnlineStaff extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getonlinestaff';
|
||||
class GETOnlineStaff extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getonlinestaff';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
function staffName($data) {
|
||||
$staff_name = Staff::where('code', $data)->where('is_history', 0)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = Staff::where('code', $data)->where('is_history', 1)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = 'Связанный персонал не найден';
|
||||
}
|
||||
}
|
||||
return $staff_name;
|
||||
}
|
||||
if ($input['method'] == 'dashboard') {
|
||||
$staff_data = [];
|
||||
$staffs = ShiftOnlineOrders::select('who_open')
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->groupBy('who_open')
|
||||
->get();
|
||||
foreach ($staffs as $key => $staff) {
|
||||
$count = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->count();
|
||||
$name = staffName($staff['who_open']);
|
||||
$code = $staff['who_open'];
|
||||
$sum = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->sum('order_sum');
|
||||
$staff_data[] = array('name' => $name, 'code' => $code + 0, 'orders_count' => $count + 0, 'orders_sum' => $sum + 0);
|
||||
}
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if ($input['method'] == 'dashboard') {
|
||||
$staff_data = [];
|
||||
$staffs = ShiftOnlineOrders::select('who_open')
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->groupBy('who_open')
|
||||
->get();
|
||||
foreach ($staffs as $staff) {
|
||||
$count = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->count();
|
||||
$name = Staff::getName($staff['who_open']);
|
||||
$code = $staff['who_open'];
|
||||
$sum = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->sum('order_sum');
|
||||
$staff_data[] = array(
|
||||
'name' => $name,
|
||||
'code' => $code + 0,
|
||||
'orders_count' => $count + 0,
|
||||
'orders_sum' => $sum + 0
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'staff' => $staff_data,
|
||||
];
|
||||
}
|
||||
if ($input['method'] == 'items') {
|
||||
if (isset($input['order'])) {
|
||||
$orderId = $input['order'] + 0;
|
||||
$items = [];
|
||||
$order = ShiftOnlineOrders::where('code', $orderId)->first();
|
||||
$who_open = staffName($order['who_open']);
|
||||
if ($order['who_close'] == 0) {
|
||||
$who_close = '-';
|
||||
} else {
|
||||
$who_close = staffName($order['who_close']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'staff' => $staff_data,
|
||||
];
|
||||
}
|
||||
if ($input['method'] == 'items') {
|
||||
if (isset($input['order'])) {
|
||||
$orderId = $input['order'] + 0;
|
||||
$items = [];
|
||||
$order = ShiftOnlineOrders::where('code', $orderId)->first();
|
||||
$who_open = Staff::getName($order['who_open']);
|
||||
if ($order['who_close'] == 0) {
|
||||
$who_close = '-';
|
||||
} else {
|
||||
$who_close = Staff::getName($order['who_close']);
|
||||
}
|
||||
|
||||
$onlineItems = ShiftOnlineItems::where('order_code', $order['code'])->where('modificator_code', 0)->get();
|
||||
foreach ($onlineItems as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$dish = Dishes::where('code', $item['dish_code'])->where('is_history', 0)->first();
|
||||
$items[] = array('name' => $dish['name'], 'discount' => round($discount, 0), 'count' => $item['count'], 'sale_price' => $salePrice, 'sum' => round($realPrice, 2));
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'who_open' => $who_open,
|
||||
'who_close' => $who_close,
|
||||
'title' => 'Подробнее о заказе №' . $order['code'],
|
||||
'total' => $order['order_sum'],
|
||||
'items' => $items,
|
||||
];
|
||||
}
|
||||
$onlineItems = ShiftOnlineItems::where('order_code', $order['code'])->where('modificator_code', 0)->get();
|
||||
foreach ($onlineItems as $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$dish_name = Dishes::getName($item['menu_code']);
|
||||
$items[] = array(
|
||||
'name' => $dish_name,
|
||||
'discount' => round($discount, 0),
|
||||
'count' => $item['count'],
|
||||
'sale_price' => $salePrice,
|
||||
'sum' => round($realPrice, 2)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'who_open' => $who_open,
|
||||
'who_close' => $who_close,
|
||||
'title' => 'Подробнее о заказе №' . $order['code'],
|
||||
'total' => $order['order_sum'],
|
||||
'items' => $items,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\Modifier;
|
||||
use App\Component\Models\OrderItems;
|
||||
use App\Component\Models\Orders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
|
||||
@@ -8,7 +8,7 @@ use App\Component\Models\Report;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class OutOrders extends HRCCommand implements HRCCommandInterface {
|
||||
class GETOutOrders extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getoutorders';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -8,7 +8,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
class GETTopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gettopdishes';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -9,7 +9,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class TopDishesNewYear extends HRCCommand implements HRCCommandInterface {
|
||||
class GETTopDishesNewYear extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gettopdishesnewyear';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
34
commands/POSTBonus.php
Normal file
34
commands/POSTBonus.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class POSTBonus extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postbonus';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$client_guid = $input['client_id'];
|
||||
$bonus_amount = $input['amount'];
|
||||
$staff_id = $input['who'];
|
||||
$bonus_time = $input['date_transaction'];
|
||||
ClientsBonus::bonusReg($client_guid, $bonus_amount);
|
||||
ClientsBonus::bonusLog($client_guid, $bonus_amount, $bonus_time, $staff_id);
|
||||
if ($bonus_amount > 0) {
|
||||
$message = 'Начислено ' . $bonus_amount . ' бонусов';
|
||||
} else {
|
||||
$message = 'Списано ' . abs($bonus_amount) . ' бонусов';
|
||||
}
|
||||
$bonus_result = ClientsBonus::getBonus($client_guid);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => $message,
|
||||
'result' => $bonus_result
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use App\Component\Models\ClientsGroup;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class CreateBarcode extends HRCCommand implements HRCCommandInterface {
|
||||
class POSTCreateBarcode extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postcreatebarcode';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -11,7 +11,7 @@ use App\Component\Models\ClientsPhone;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class CreateClient extends HRCCommand implements HRCCommandInterface {
|
||||
class POSTCreateClient extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postcreateclient';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -6,7 +6,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Fiscals extends HRCCommand implements HRCCommandInterface {
|
||||
class POSTFiscals extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postfiscals';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
33
commands/POSTPresale.php
Normal file
33
commands/POSTPresale.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTPresale extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postpresale';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$client_guid = $input['client_id'];
|
||||
$presale_amount = $input['amount'];
|
||||
$staff_id = $input['who'];
|
||||
$presale_time = $input['date_transaction'];
|
||||
ClientsPresale::presaleReg($client_guid, $presale_amount);
|
||||
ClientsPresale::presaleLog($client_guid, $presale_amount, $presale_time, $staff_id);
|
||||
if ($presale_amount > 0) {
|
||||
$message = 'Внесен аванс на сумму ' . $presale_amount . ' BYN';
|
||||
} else {
|
||||
$message = 'Зачтен аванс на сумму ' . abs($presale_amount) . ' BYN';
|
||||
}
|
||||
$presale_result = ClientsPresale::getPresale($client_guid);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => $message,
|
||||
'result' => $presale_result
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Printers extends HRCCommand implements HRCCommandInterface {
|
||||
class POSTPrinters extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postprinters';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
@@ -47,9 +47,9 @@ class UpdateCoreInterface extends Migration
|
||||
copy($indexUpd . $file, CORE_PATH . '/../../web/app/' . $file);
|
||||
}
|
||||
}
|
||||
if (file_exists(CORE_PATH . '/../V1/forUpdate/')) {
|
||||
/* if (file_exists(CORE_PATH . '/../V1/forUpdate/')) {
|
||||
deleteFolder(CORE_PATH . '/../V1/forUpdate/');
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsPresalesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('clients_presales')) {
|
||||
Schema::create('clients_presales', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('client_guid');
|
||||
$table->decimal('value', $precision = 16, $scale = 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('clients_presales');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsBonusesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('clients_bonuses')) {
|
||||
Schema::create('clients_bonuses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('client_guid');
|
||||
$table->decimal('value', $precision = 16, $scale = 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('clients_bonuses');
|
||||
}
|
||||
}
|
||||
@@ -29,5 +29,8 @@ class AddStaffRights extends Seeder
|
||||
if (Right::where('code', 'eorders')->count() == 0) {
|
||||
Right::add('eorders', 'Онлайн заказы');
|
||||
}
|
||||
if (Right::where('code', 'loyalty')->count() == 0) {
|
||||
Right::add('loyalty', 'Loyalty');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,8 @@ class AddUserRights extends Seeder
|
||||
if (StaffRights::where('code', 'RIGHT_61')->count() == 0) {
|
||||
StaffRights::add('RIGHT_61', 'Печать копии чека из журнала заказов');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_62')->count() == 0) {
|
||||
StaffRights::add('RIGHT_62', 'Отправка чека на email');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,55 @@ class Client extends Model {
|
||||
public function clientPhone() {
|
||||
return $this->belongsTo('App\Component\Models\ClientsPhone', 'user_code', 'client_guid');
|
||||
}
|
||||
|
||||
public static function getPhone($guid) {
|
||||
$phone = ClientsPhone::where('client_guid', $guid)->first();
|
||||
if (isset($phone)) {
|
||||
$phone = $phone['phone'];
|
||||
} else {
|
||||
$phone = '';
|
||||
}
|
||||
return $phone;
|
||||
}
|
||||
|
||||
public static function getEmail($guid) {
|
||||
$email = ClientsEmail::where('client_guid', $guid)->first();
|
||||
if (isset($email)) {
|
||||
$email = $email['email'];
|
||||
} else {
|
||||
$email = '';
|
||||
}
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function getAddress($guid) {
|
||||
$address = ClientsAddress::where('client_guid', $guid)->first();
|
||||
if (isset($address)) {
|
||||
$address = $address['address'];
|
||||
} else {
|
||||
$address = '';
|
||||
}
|
||||
return $address;
|
||||
}
|
||||
|
||||
public static function getBarcode($guid) {
|
||||
$barcode = ClientsBarcode::where('client_guid', $guid)->first();
|
||||
if (isset($barcode)) {
|
||||
$barcode = $barcode['value'];
|
||||
} else {
|
||||
$barcode = '';
|
||||
}
|
||||
return $barcode;
|
||||
}
|
||||
|
||||
public static function getID($guid) {
|
||||
$id = Client::where('client_guid', $guid)->first();
|
||||
if (isset($id)) {
|
||||
$id = $id['id'];
|
||||
} else {
|
||||
$id = '';
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
}
|
||||
11
models/ClientsActions.php
Normal file
11
models/ClientsActions.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientsActions extends Model
|
||||
{
|
||||
protected $table = 'clients_actions';
|
||||
protected $guarded = [];
|
||||
}
|
||||
60
models/ClientsBonus.php
Normal file
60
models/ClientsBonus.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientsBonus extends Model
|
||||
{
|
||||
protected $table = 'clients_bonuses';
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Bonus info.
|
||||
*/
|
||||
public static function getBonus($guid)
|
||||
{
|
||||
$bonus = ClientsBonus::where('client_guid', $guid)->first();
|
||||
if (isset($bonus)) {
|
||||
$bonus = $bonus['value'];
|
||||
} else {
|
||||
$bonus = 0;
|
||||
}
|
||||
return $bonus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save bonus value.
|
||||
*/
|
||||
public static function bonusReg($guid, $value)
|
||||
{
|
||||
$bonus_value = ClientsBonus::where('client_guid', $guid)->first();
|
||||
$bonus = ClientsBonus::updateOrCreate(
|
||||
['client_guid' => $guid],
|
||||
['value' => $bonus_value['value'] + $value]
|
||||
);
|
||||
|
||||
return $bonus['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Bonus log.
|
||||
*/
|
||||
public static function bonusLog($guid, $value, $time, $staff_id)
|
||||
{
|
||||
if ($value > 0) {
|
||||
$action_name = 'Зачиление бонусов';
|
||||
} else {
|
||||
$action_name = 'Списание бонусов';
|
||||
}
|
||||
$action = new ClientsActions();
|
||||
$action->action = $action_name;
|
||||
$action->created = Carbon::createFromTimestampUTC($time)->timezone('Europe/Minsk');
|
||||
$action->user_id = $guid;
|
||||
$action->action_value = abs($value);
|
||||
$action->action_type = 1;
|
||||
$action->who = $staff_id;
|
||||
$action->save();
|
||||
}
|
||||
}
|
||||
60
models/ClientsPresale.php
Normal file
60
models/ClientsPresale.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientsPresale extends Model
|
||||
{
|
||||
protected $table = 'clients_presales';
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Presale info.
|
||||
*/
|
||||
public static function getPresale($guid)
|
||||
{
|
||||
$presale = ClientsPresale::where('client_guid', $guid)->first();
|
||||
if (isset($presale)) {
|
||||
$presale = $presale['value'];
|
||||
} else {
|
||||
$presale = 0;
|
||||
}
|
||||
return $presale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save presale value.
|
||||
*/
|
||||
public static function presaleReg($guid, $value)
|
||||
{
|
||||
$presale_value = ClientsPresale::where('client_guid', $guid)->first();
|
||||
$presale = ClientsPresale::updateOrCreate(
|
||||
['client_guid' => $guid],
|
||||
['value' => $presale_value['value'] + $value]
|
||||
);
|
||||
|
||||
return $presale['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Presale log.
|
||||
*/
|
||||
public static function presaleLog($guid, $value, $time, $staff_id)
|
||||
{
|
||||
if ($value > 0) {
|
||||
$action_name = 'Внесение аванса';
|
||||
} else {
|
||||
$action_name = 'Зачет аванса';
|
||||
}
|
||||
$action = new ClientsActions();
|
||||
$action->action = $action_name;
|
||||
$action->created = Carbon::createFromTimestampUTC($time)->timezone('Europe/Minsk');
|
||||
$action->user_id = $guid;
|
||||
$action->action_value = abs($value);
|
||||
$action->action_type = 2;
|
||||
$action->who = $staff_id;
|
||||
$action->save();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,78 @@ namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ExchangeOrders extends Model {
|
||||
protected $table = 'exchange_orders';
|
||||
class ExchangeOrders extends Model
|
||||
{
|
||||
protected $table = 'exchange_orders';
|
||||
|
||||
/**
|
||||
* Get order info
|
||||
*/
|
||||
public static function getInfo($order_id, $shift_id)
|
||||
{
|
||||
$order = ExchangeOrders::where('code', $order_id)->where('shift_id', $shift_id)->first();
|
||||
$open_time = $order['opened'];
|
||||
$close_time = $order['closed'];
|
||||
$who_open = Staff::getName($order['who_open']);
|
||||
$who_close = Staff::getName($order['who_close']);
|
||||
$items = ExchangeItems::where('order_code', $order_id)->where('shift_id', $shift_id)->get();
|
||||
$order_status = '';
|
||||
if ($order['is_deleted'] > 0) {
|
||||
$order_status = 'Удален';
|
||||
} elseif ($order['is_returned'] > 0) {
|
||||
$order_status = 'Возвращен';
|
||||
} elseif ($order['is_waited'] > 0 && $order['is_closed'] < 1) {
|
||||
$order_status = 'В ожидании';
|
||||
} else {
|
||||
$order_status = 'Оплачен';
|
||||
}
|
||||
$order_cash = $order['cash'];
|
||||
$order_credit = $order['credit'];
|
||||
$order_clearing = $order['clearing'];
|
||||
$order_presale = $order['presale'];
|
||||
$order_self = $order['self'];
|
||||
$order_info = [];
|
||||
$amount = $full_price = 0;
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$order_info[] = array(
|
||||
'id' => $key + 1,
|
||||
'name' => Dishes::getName($item['dish_code']),
|
||||
'count' => $item['count'],
|
||||
'price' => $item['real_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cof' => $item['cof'],
|
||||
'unit' => Units::getName($item['units_id']),
|
||||
'amount' => round($item['sale_price'] * $item['count'], 2),
|
||||
'discount' => round($discount, 2)
|
||||
);
|
||||
$amount += round($item['sale_price'] * $item['count'], 2);
|
||||
$full_price += round($realPrice,2);
|
||||
}
|
||||
$order = [];
|
||||
$order[] = array(
|
||||
'order_id' => $order_id,
|
||||
'opened' => $open_time,
|
||||
'closed' => $close_time,
|
||||
'who_open' => $who_open,
|
||||
'who_close' => $who_close,
|
||||
'order_status' => $order_status,
|
||||
'amount' => $amount,
|
||||
'full_price' => $full_price,
|
||||
'cash' => $order_cash,
|
||||
'credit' => $order_credit,
|
||||
'clearing' => $order_clearing,
|
||||
'self' => $order_self,
|
||||
'presale' => $order_presale,
|
||||
'items' => $order_info
|
||||
);
|
||||
return $order;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,78 @@ namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ShiftOnlineOrders extends Model {
|
||||
protected $table = 'shift_online_orders';
|
||||
class ShiftOnlineOrders extends Model
|
||||
{
|
||||
protected $table = 'shift_online_orders';
|
||||
|
||||
/**
|
||||
* Get order info
|
||||
*/
|
||||
public static function getInfo($order_id)
|
||||
{
|
||||
$order = ShiftOnlineOrders::where('code', $order_id)->first();
|
||||
$open_time = $order['opened'];
|
||||
$close_time = $order['closed'];
|
||||
$who_open = Staff::getName($order['who_open']);
|
||||
$who_close = Staff::getName($order['who_close']);
|
||||
$items = ShiftOnlineItems::where('order_code', $order_id)->get();
|
||||
$order_status = '';
|
||||
if ($order['is_deleted'] > 0) {
|
||||
$order_status = 'Удален';
|
||||
} elseif ($order['is_returned'] > 0) {
|
||||
$order_status = 'Возвращен';
|
||||
} elseif ($order['is_waited'] > 0 && $order['is_closed'] < 1) {
|
||||
$order_status = 'В ожидании';
|
||||
} else {
|
||||
$order_status = 'Оплачен';
|
||||
}
|
||||
$order_cash = $order['cash'];
|
||||
$order_credit = $order['credit'];
|
||||
$order_clearing = $order['clearing'];
|
||||
$order_presale = $order['presale'];
|
||||
$order_self = $order['self'];
|
||||
$order_info = [];
|
||||
$amount = $full_price = 0;
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$order_info[] = array(
|
||||
'id' => $key + 1,
|
||||
'name' => Dishes::getName($item['dish_code']),
|
||||
'count' => $item['count'],
|
||||
'price' => $item['real_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cof' => $item['cof'],
|
||||
'unit' => Units::getName($item['units_id']),
|
||||
'amount' => round($item['sale_price'] * $item['count'], 2),
|
||||
'discount' => round($discount, 2)
|
||||
);
|
||||
$amount += round($item['sale_price'] * $item['count'], 2);
|
||||
$full_price += round($realPrice,2);
|
||||
}
|
||||
$order = [];
|
||||
$order[] = array(
|
||||
'order_id' => $order_id,
|
||||
'opened' => $open_time,
|
||||
'closed' => $close_time,
|
||||
'who_open' => $who_open,
|
||||
'who_close' => $who_close,
|
||||
'order_status' => $order_status,
|
||||
'amount' => $amount,
|
||||
'full_price' => $full_price,
|
||||
'cash' => $order_cash,
|
||||
'credit' => $order_credit,
|
||||
'clearing' => $order_clearing,
|
||||
'self' => $order_self,
|
||||
'presale' => $order_presale,
|
||||
'items' => $order_info
|
||||
);
|
||||
return $order;
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,25 @@ namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Units extends Model {
|
||||
protected $table = 'units';
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
class Units extends Model
|
||||
{
|
||||
protected $table = 'units';
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
public static function getName($data)
|
||||
{
|
||||
$unit_in_list = UnitsList::where('id', $data)->first();
|
||||
$unit_name = Units::where('id', $unit_in_list['unit_id'])->first();
|
||||
if ($unit_name) {
|
||||
$unit_name = $unit_name['name'];
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
return $unit_name;
|
||||
}
|
||||
}
|
||||
@@ -1,353 +1,364 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
angular
|
||||
.module('app')
|
||||
.controller('ClientsCtrl', ClientsCtrl);
|
||||
(function () {
|
||||
'use strict';
|
||||
angular
|
||||
.module('app')
|
||||
.controller('ClientsCtrl', ClientsCtrl);
|
||||
|
||||
ClientsCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$rootScope', '$timeout'];
|
||||
function ClientsCtrl($scope, smartRequest, Notification, $rootScope, $timeout) {
|
||||
$scope.clients = [];
|
||||
$scope.groups = [];
|
||||
$scope.statuses = [];
|
||||
$scope.filedate = '';
|
||||
$scope.currentGroupId = 0;
|
||||
$scope.currentClientId = 0;
|
||||
ClientsCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$rootScope', '$timeout'];
|
||||
|
||||
$scope.currentClient = {};
|
||||
|
||||
$scope.orders = [];
|
||||
$scope.order = {};
|
||||
function ClientsCtrl($scope, smartRequest, Notification, $rootScope, $timeout) {
|
||||
$scope.clients = [];
|
||||
$scope.groups = [];
|
||||
$scope.statuses = [];
|
||||
$scope.filedate = '';
|
||||
$scope.currentGroupId = 0;
|
||||
$scope.currentClientId = 0;
|
||||
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.newGroup = {};
|
||||
$scope.newBarcode = {};
|
||||
$scope.currentClient = {};
|
||||
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.newClient = {};
|
||||
$scope.orders = [];
|
||||
$scope.order = {};
|
||||
|
||||
$scope.search = {
|
||||
query: ''
|
||||
};
|
||||
|
||||
var promise = 0;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.newGroup = {};
|
||||
$scope.newBarcode = {};
|
||||
|
||||
$scope.clientsSearch = function() {
|
||||
|
||||
}
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.newClient = {};
|
||||
|
||||
$scope.update = function() {
|
||||
smartRequest.get('client/list?page=' + $scope.currentPage, function(data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.countOfPages = data.pages;
|
||||
$scope.pages = $scope.makePages();
|
||||
});
|
||||
};
|
||||
$scope.search = {
|
||||
query: ''
|
||||
};
|
||||
|
||||
$scope.getGroups = function() {
|
||||
smartRequest.get('v1/clientgroup', function(data) {
|
||||
$scope.groups = data.groups;
|
||||
$scope.filedate = data.filedate;
|
||||
$scope.openGroup({id: 0});
|
||||
});
|
||||
};
|
||||
var promise = 0;
|
||||
|
||||
|
||||
$scope.openGroup = function(group) {
|
||||
if (typeof group === 'object') {
|
||||
$scope.currentGroup = group.id;
|
||||
} else {
|
||||
$scope.currentGroup = group;
|
||||
}
|
||||
$scope.currentPage = 1;
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function(data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
$scope.total = data.total;
|
||||
});
|
||||
$scope.clientsSearch = function () {
|
||||
|
||||
};
|
||||
|
||||
$scope.editGroup = function (group) {
|
||||
$scope.contextElement = group;
|
||||
}
|
||||
|
||||
$('#edit-group').modal('toggle');
|
||||
console.log(group);
|
||||
};
|
||||
$scope.update = function () {
|
||||
smartRequest.get('client/list?page=' + $scope.currentPage, function (data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.countOfPages = data.pages;
|
||||
$scope.pages = $scope.makePages();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateGroup = function () {
|
||||
$('#edit-group').modal('toggle');
|
||||
$scope.getGroups = function () {
|
||||
smartRequest.get('v1/clientgroup', function (data) {
|
||||
$scope.groups = data.groups;
|
||||
$scope.filedate = data.filedate;
|
||||
$scope.openGroup({id: 0});
|
||||
});
|
||||
};
|
||||
|
||||
smartRequest.post('v1/clientgroup', {
|
||||
id: $scope.contextElement.id,
|
||||
name: $scope.contextElement.name,
|
||||
task: 'update'
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeGroup = function () {
|
||||
$('#group-confirm-delete').modal('toggle');
|
||||
$('#edit-group').modal('toggle');
|
||||
$scope.openGroup = function (group) {
|
||||
if (typeof group === 'object') {
|
||||
$scope.currentGroup = group.id;
|
||||
} else {
|
||||
$scope.currentGroup = group;
|
||||
}
|
||||
$scope.currentPage = 1;
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function (data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
$scope.total = data.total;
|
||||
$scope.closeCard();
|
||||
$scope.orders = [];
|
||||
$scope.currentClient = [];
|
||||
$scope.clientLogs = [];
|
||||
});
|
||||
|
||||
smartRequest.post('v1/clientgroup', {
|
||||
id: $scope.contextElement.id,
|
||||
task: 'delete'
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
if (data.message) {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.editClient = function (client, group) {
|
||||
$scope.contextElement = client;
|
||||
$scope.contextGroup = group;
|
||||
$('#edit-client').modal('toggle');
|
||||
console.log(client);
|
||||
console.log($scope.contextGroup);
|
||||
};
|
||||
};
|
||||
|
||||
$scope.updateClient = function (group) {
|
||||
$('#edit-client').modal('toggle');
|
||||
$scope.editGroup = function (group) {
|
||||
$scope.contextElement = group;
|
||||
|
||||
smartRequest.post('v1/client', {
|
||||
id: $scope.contextElement.id,
|
||||
name: $scope.contextElement.name,
|
||||
group_id: group,
|
||||
phone: $scope.contextElement.phone,
|
||||
address: $scope.contextElement.address,
|
||||
email: $scope.contextElement.email,
|
||||
barcode: $scope.contextElement.barcode,
|
||||
task: 'update'
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
$scope.openGroup(group);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
$('#edit-group').modal('toggle');
|
||||
console.log(group);
|
||||
};
|
||||
|
||||
$scope.removeClient = function () {
|
||||
$('#client-confirm-delete').modal('toggle');
|
||||
$('#edit-client').modal('toggle');
|
||||
$scope.updateGroup = function () {
|
||||
$('#edit-group').modal('toggle');
|
||||
|
||||
smartRequest.post('v1/client', {
|
||||
id: $scope.contextElement.id,
|
||||
task: 'delete'
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
$scope.openGroup($scope.currentGroup);
|
||||
if (data.message) {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
smartRequest.post('v1/clientgroup', {
|
||||
id: $scope.contextElement.id,
|
||||
name: $scope.contextElement.name,
|
||||
task: 'update'
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.pager = function(currentPage) {
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function(data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
$scope.total = data.total;
|
||||
});
|
||||
};
|
||||
$scope.removeGroup = function () {
|
||||
$('#group-confirm-delete').modal('toggle');
|
||||
$('#edit-group').modal('toggle');
|
||||
|
||||
$scope.getClients = function() {
|
||||
if ($scope.search.query.length === 0) {
|
||||
$scope.openGroup({id: $scope.currentGroupId});
|
||||
}
|
||||
else {
|
||||
smartRequest.post('client/search', {
|
||||
name: $scope.search.query
|
||||
},
|
||||
function (data) {
|
||||
$scope.clients = data.clients;
|
||||
});
|
||||
}
|
||||
};
|
||||
smartRequest.post('v1/clientgroup', {
|
||||
id: $scope.contextElement.id,
|
||||
task: 'delete'
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
if (data.message) {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openFormCreateGroup = function() {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.isCreateNewGroup = !$scope.isCreateNewGroup;
|
||||
};
|
||||
$scope.editClient = function (client, group) {
|
||||
|
||||
$scope.openFormCreateClient = function() {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.isCreateNewClient = !$scope.isCreateNewClient;
|
||||
};
|
||||
$scope.contextElement = client;
|
||||
$scope.contextGroup = group;
|
||||
$('#edit-client').modal('toggle');
|
||||
console.log(client);
|
||||
console.log($scope.contextGroup);
|
||||
};
|
||||
|
||||
$scope.openFormCreateBarcode = function() {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = !$scope.isCreateNewBarcode;
|
||||
smartRequest.get('v1/clientgroup', function(data) {
|
||||
$scope.groups = data.groups;
|
||||
});
|
||||
};
|
||||
$scope.updateClient = function (group) {
|
||||
$('#edit-client').modal('toggle');
|
||||
|
||||
$scope.createGroup = function() {
|
||||
smartRequest.post('client/group/create', {
|
||||
name: $scope.newGroup.name
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
smartRequest.post('v1/client', {
|
||||
id: $scope.contextElement.id,
|
||||
name: $scope.contextElement.name,
|
||||
group_id: group,
|
||||
phone: $scope.contextElement.phone,
|
||||
address: $scope.contextElement.address,
|
||||
email: $scope.contextElement.email,
|
||||
barcode: $scope.contextElement.barcode,
|
||||
task: 'update'
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
$scope.openGroup(group);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.createClient = function() {
|
||||
smartRequest.post('v1/createclient/', {
|
||||
name: $scope.newClient.name,
|
||||
group_id: $scope.currentGroup,
|
||||
phone: $scope.newClient.phone,
|
||||
address: $scope.newClient.address,
|
||||
email: $scope.newClient.email,
|
||||
barcode: $scope.newClient.barcode,
|
||||
is_special_price: $scope.newClient.special_price
|
||||
}, function(data) {
|
||||
$scope.pager($scope.currentGroup);
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
$scope.removeClient = function () {
|
||||
$('#client-confirm-delete').modal('toggle');
|
||||
$('#edit-client').modal('toggle');
|
||||
|
||||
$scope.createBarcode = function() {
|
||||
console.log($scope.newBarcode.group_id);
|
||||
smartRequest.post('v1/createbarcode/', {
|
||||
group_id: $scope.newBarcode.group_id,
|
||||
start: $scope.newBarcode.start,
|
||||
end: $scope.newBarcode.end,
|
||||
}, function(data) {
|
||||
$scope.getGroups();
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
smartRequest.post('v1/client', {
|
||||
id: $scope.contextElement.id,
|
||||
task: 'delete'
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
$scope.openGroup($scope.currentGroup);
|
||||
if (data.message) {
|
||||
Notification.success(data.message);
|
||||
}
|
||||
if (data.error_message) {
|
||||
Notification.error(data.error_message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.closeCard = function() {
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.currentClientId = 0;
|
||||
};
|
||||
$scope.pager = function (currentPage) {
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function (data) {
|
||||
$scope.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
$scope.total = data.total;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openClientInfo = function(client) {
|
||||
$scope.currentClientId = client.id;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.getClients = function () {
|
||||
if ($scope.search.query.length === 0) {
|
||||
$scope.openGroup({id: $scope.currentGroupId});
|
||||
} else {
|
||||
smartRequest.post('client/search', {
|
||||
name: $scope.search.query
|
||||
},
|
||||
function (data) {
|
||||
$scope.clients = data.clients;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
smartRequest.get('client/client/info?id=' + $scope.currentClientId, function(data) {
|
||||
$scope.currentClient = data.client;
|
||||
$scope.openFormCreateGroup = function () {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.isCreateNewGroup = !$scope.isCreateNewGroup;
|
||||
};
|
||||
|
||||
smartRequest.get('client/orders?client_id=' + $scope.currentClient.id, function(data) {
|
||||
$scope.orders = data.orders;
|
||||
});
|
||||
});
|
||||
};
|
||||
$scope.openFormCreateClient = function () {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.isCreateNewClient = !$scope.isCreateNewClient;
|
||||
};
|
||||
|
||||
$scope.getItems = function(order) {
|
||||
smartRequest.get('client/order?order_id=' + order.id, function(data) {
|
||||
$scope.order = data;
|
||||
$('#order').modal('toggle');
|
||||
});
|
||||
};
|
||||
|
||||
var mergeFiles = function (statuses) {
|
||||
if (statuses == 4) {
|
||||
smartRequest.get('v1/clientfile?complete=1', function(data) {
|
||||
$scope.filedate = data.filedate;
|
||||
$scope.filename = data.filename;
|
||||
$scope.terminalkey = data.terminalKey;
|
||||
$scope.downloadClientFile();
|
||||
$scope.statuses = [];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.createClientFile = function(count) {
|
||||
smartRequest.get('v1/clientfile?th=1', function(data) {
|
||||
if(data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=2', function(data) {
|
||||
if(data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=3', function(data) {
|
||||
if(data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=4', function(data) {
|
||||
if(data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.downloadClientFile = function() {
|
||||
smartRequest.get('v1/clientgroup', function(data) {
|
||||
window.open(window.location.protocol + '//' + window.location.hostname + '/Exchange/' + $scope.terminalkey +'/'+ $scope.filename);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.clientsSearch = function () {
|
||||
if (promise) {
|
||||
$timeout.cancel(promise);
|
||||
}
|
||||
promise = $timeout(function () {
|
||||
if ($scope.search.query.length === 0) {
|
||||
$scope.getGroups();
|
||||
}
|
||||
else {
|
||||
$scope.groups = [];
|
||||
}
|
||||
$scope.openFormCreateBarcode = function () {
|
||||
$scope.currentClientId = 0;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = !$scope.isCreateNewBarcode;
|
||||
smartRequest.get('v1/clientgroup', function (data) {
|
||||
$scope.groups = data.groups;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getClients();
|
||||
}, 300);
|
||||
};
|
||||
|
||||
$scope.clearSearchInput = function () {
|
||||
$scope.search.query = '';
|
||||
$scope.clientsSearch();
|
||||
};
|
||||
$scope.createGroup = function () {
|
||||
smartRequest.post('client/group/create', {
|
||||
name: $scope.newGroup.name
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getGroups();
|
||||
}
|
||||
}
|
||||
$scope.createClient = function () {
|
||||
smartRequest.post('v1/createclient/', {
|
||||
name: $scope.newClient.name,
|
||||
group_id: $scope.currentGroup,
|
||||
phone: $scope.newClient.phone,
|
||||
address: $scope.newClient.address,
|
||||
email: $scope.newClient.email,
|
||||
barcode: $scope.newClient.barcode,
|
||||
is_special_price: $scope.newClient.special_price
|
||||
}, function (data) {
|
||||
$scope.pager($scope.currentGroup);
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.createBarcode = function () {
|
||||
console.log($scope.newBarcode.group_id);
|
||||
smartRequest.post('v1/createbarcode/', {
|
||||
group_id: $scope.newBarcode.group_id,
|
||||
start: $scope.newBarcode.start,
|
||||
end: $scope.newBarcode.end,
|
||||
}, function (data) {
|
||||
$scope.getGroups();
|
||||
$scope.closeCard();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.closeCard = function () {
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.currentClientId = 0;
|
||||
};
|
||||
|
||||
$scope.openClientInfo = function (client) {
|
||||
$scope.currentClientId = client.id;
|
||||
$scope.isCreateNewGroup = false;
|
||||
$scope.isCreateNewClient = false;
|
||||
$scope.isCreateNewBarcode = false;
|
||||
$scope.orders = [];
|
||||
$scope.currentClient = [];
|
||||
$scope.clientLogs = [];
|
||||
smartRequest.get('v1/clientinfo?id=' + $scope.currentClientId, function (data) {
|
||||
$scope.currentClient = data.client;
|
||||
smartRequest.get('v1/clientlog?id=' + $scope.currentClient.id, function (data) {
|
||||
$scope.clientLogs = data.client.info;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getOrders = function (client_id) {
|
||||
smartRequest.get('v1/clientorders?id=' + client_id, function (data) {
|
||||
$scope.orders = data.orders;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getItems = function (order_id, opened, closed) {
|
||||
smartRequest.get('v1/clientorderinfo?order_id=' + order_id + '&opened=' + opened + '&closed=' + closed, function (data) {
|
||||
$scope.order = data.info;
|
||||
$('#order').modal('toggle');
|
||||
});
|
||||
};
|
||||
|
||||
var mergeFiles = function (statuses) {
|
||||
if (statuses == 4) {
|
||||
smartRequest.get('v1/clientfile?complete=1', function (data) {
|
||||
$scope.filedate = data.filedate;
|
||||
$scope.filename = data.filename;
|
||||
$scope.terminalkey = data.terminalKey;
|
||||
$scope.downloadClientFile();
|
||||
$scope.statuses = [];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.createClientFile = function (count) {
|
||||
smartRequest.get('v1/clientfile?th=1', function (data) {
|
||||
if (data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=2', function (data) {
|
||||
if (data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=3', function (data) {
|
||||
if (data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
smartRequest.get('v1/clientfile?th=4', function (data) {
|
||||
if (data.status == 'success') {
|
||||
$scope.statuses.push(data.status);
|
||||
console.log($scope.statuses);
|
||||
$scope.statusCount = $scope.statuses.length;
|
||||
mergeFiles($scope.statusCount);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.downloadClientFile = function () {
|
||||
smartRequest.get('v1/clientgroup', function (data) {
|
||||
window.open(window.location.protocol + '//' + window.location.hostname + '/Exchange/' + $scope.terminalkey + '/' + $scope.filename);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.clientsSearch = function () {
|
||||
if (promise) {
|
||||
$timeout.cancel(promise);
|
||||
}
|
||||
promise = $timeout(function () {
|
||||
if ($scope.search.query.length === 0) {
|
||||
$scope.getGroups();
|
||||
} else {
|
||||
$scope.groups = [];
|
||||
}
|
||||
|
||||
$scope.getClients();
|
||||
}, 300);
|
||||
};
|
||||
|
||||
$scope.clearSearchInput = function () {
|
||||
$scope.search.query = '';
|
||||
$scope.clientsSearch();
|
||||
};
|
||||
|
||||
$scope.getGroups();
|
||||
}
|
||||
}
|
||||
)();
|
||||
340
web/controllers/loyalty.js
Normal file
340
web/controllers/loyalty.js
Normal file
@@ -0,0 +1,340 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
angular
|
||||
.module('app')
|
||||
.controller('LoyaltyCtrl', LoyaltyCtrl);
|
||||
|
||||
LoyaltyCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
|
||||
function LoyaltyCtrl($scope, smartRequest, Notification) {
|
||||
$scope.discounts = [];
|
||||
$scope.currentDiscount = {};
|
||||
$scope.terms = [];
|
||||
$scope.defaultTerm = 0;
|
||||
$scope.currentTerms = [];
|
||||
|
||||
$scope.readonlyMode = false;
|
||||
|
||||
$scope.selectedElement = {
|
||||
type: '',
|
||||
value: 0,
|
||||
currentModal: '',
|
||||
param: {},
|
||||
info: '',
|
||||
subtype: ''
|
||||
};
|
||||
|
||||
$scope.navigationStack = [];
|
||||
|
||||
$scope.update = function() {
|
||||
smartRequest.get('discount/list', function(data) {
|
||||
for(var i = 0; i < data.discounts.length; i++) {
|
||||
if(data.discounts[i].start_date === '0') {
|
||||
data.discounts[i].start_date = '';
|
||||
}
|
||||
|
||||
if(data.discounts[i].end_date === '0') {
|
||||
data.discounts[i].end_date = '';
|
||||
}
|
||||
|
||||
data.discounts[i].is_enable = data.discounts[i].is_enable === '1';
|
||||
data.discounts[i].is_check_all = data.discounts[i].is_check_all === '1';
|
||||
}
|
||||
|
||||
$scope.discounts = data.discounts;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function() {
|
||||
$('#edit-discount-confirm-delete').modal('toggle');
|
||||
$('#edit-discount').modal('toggle');
|
||||
|
||||
smartRequest.post('discount/delete', {
|
||||
id: $scope.currentDiscount.id
|
||||
}, function(data) {
|
||||
$scope.update();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.add = function() {
|
||||
$scope.currentDiscount = {};
|
||||
$scope.currentDiscount.value_type = '0';
|
||||
|
||||
$('#new-discount').modal();
|
||||
};
|
||||
|
||||
$scope.create = function() {
|
||||
$('#new-discount').modal('toggle');
|
||||
|
||||
smartRequest.post('discount/store', {
|
||||
name: $scope.currentDiscount.name,
|
||||
value_type: $scope.currentDiscount.value_type,
|
||||
value: $scope.currentDiscount.value
|
||||
}, function(data) {
|
||||
$scope.update();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(discount) {
|
||||
$scope.currentDiscount = discount;
|
||||
$scope.currentDiscount.new_term_type = $scope.defaultTerm;
|
||||
|
||||
$scope.updateTerms();
|
||||
|
||||
$('#edit-discount').modal();
|
||||
};
|
||||
|
||||
$scope.save = function() {
|
||||
$('#edit-discount').modal('toggle');
|
||||
|
||||
smartRequest.post('discount/update', {
|
||||
id: $scope.currentDiscount.id,
|
||||
name: $scope.currentDiscount.name,
|
||||
value_type: $scope.currentDiscount.value_type,
|
||||
value: $scope.currentDiscount.value,
|
||||
is_enable: $scope.currentDiscount.is_enable,
|
||||
start_date: $scope.currentDiscount.start_date,
|
||||
end_date: $scope.currentDiscount.end_date,
|
||||
is_check_all: $scope.currentDiscount.is_check_all
|
||||
}, function(data) {
|
||||
for(var i = 0; i < $scope.currentTerms.length; i++) {
|
||||
var params = [];
|
||||
|
||||
for(var j = 0; j < $scope.currentTerms[i].params.length; j++) {
|
||||
params.push({
|
||||
code: $scope.currentTerms[i].params[j].code,
|
||||
value: $scope.currentTerms[i].params[j].value,
|
||||
subtype: $scope.currentTerms[i].params[j].subtype
|
||||
});
|
||||
}
|
||||
|
||||
smartRequest.post('discount/term/update', {
|
||||
id: $scope.currentTerms[i].id,
|
||||
is_term: $scope.currentTerms[i].is_term === false,
|
||||
value: JSON.stringify(params)
|
||||
});
|
||||
}
|
||||
|
||||
Notification.success('Скидка сохранена');
|
||||
|
||||
$scope.update();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateTerms = function() {
|
||||
smartRequest.get('discount/term/list?discount_code=' + $scope.currentDiscount.code, function(data) {
|
||||
for(var i = 0; i < data.discount_terms.length; i++) {
|
||||
data.discount_terms[i].is_term = data.discount_terms[i].is_term === '0';
|
||||
}
|
||||
|
||||
$scope.currentTerms = data.discount_terms;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addTerm = function() {
|
||||
smartRequest.post('discount/term/store', {
|
||||
discount_code: $scope.currentDiscount.code,
|
||||
discount_type: $scope.currentDiscount.new_term_type
|
||||
}, function(data) {
|
||||
$scope.update();
|
||||
$scope.updateTerms();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.askDeleteTerm = function(term) {
|
||||
$scope.currentTerm = term;
|
||||
|
||||
$('#edit-term-confirm-delete').modal();
|
||||
};
|
||||
|
||||
$scope.deleteTerm = function() {
|
||||
$('#edit-term-confirm-delete').modal('toggle');
|
||||
|
||||
smartRequest.post('discount/term/delete', {
|
||||
id: $scope.currentTerm.id
|
||||
}, function(data) {
|
||||
$scope.updateTerms();
|
||||
});
|
||||
};
|
||||
|
||||
/* MENU BLOCK */
|
||||
$scope.selectMenuItemParams = {
|
||||
currentMenu: 0,
|
||||
currentFolder: 0,
|
||||
menus: [],
|
||||
folders: [],
|
||||
items: []
|
||||
};
|
||||
|
||||
$scope.selectedMenuElement = {};
|
||||
$scope.selectMenuNavigationStack = [];
|
||||
|
||||
$scope.selectMenuItem = function() {
|
||||
$scope.selectMenuItemParams = {
|
||||
currentMenu: 0,
|
||||
currentFolder: 0,
|
||||
menus: [],
|
||||
folders: [],
|
||||
items: []
|
||||
};
|
||||
|
||||
smartRequest.get('menu/list', function (data) {
|
||||
$scope.selectMenuItemParams.menus = data.menus;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openMenuItem = function(menu) {
|
||||
$scope.selectMenuItemParams.currentMenu = menu.id;
|
||||
|
||||
$scope.selectMenuNavigationStack.push({
|
||||
type: 'menu',
|
||||
value: menu
|
||||
});
|
||||
|
||||
smartRequest.get('menu/folder/list?menu_id=' + $scope.selectMenuItemParams.currentMenu + '&parent_id=0', function (data) {
|
||||
$scope.selectMenuItemParams.folders = data.folders;
|
||||
});
|
||||
|
||||
smartRequest.get('menu/dish/list?menu_id=' + $scope.selectMenuItemParams.currentMenu + '&parent_id=0', function (data) {
|
||||
$scope.selectMenuItemParams.items = data.dishes;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openFolderItem = function(folder) {
|
||||
$scope.selectMenuItemParams.currentFolder = folder.id;
|
||||
|
||||
$scope.selectMenuNavigationStack.push({
|
||||
type: 'folder',
|
||||
value: folder
|
||||
});
|
||||
|
||||
smartRequest.get('menu/folder/list?menu_id=' + $scope.selectMenuItemParams.currentMenu + '&parent_id=' + $scope.selectMenuItemParams.currentFolder, function (data) {
|
||||
$scope.selectMenuItemParams.folders = data.folders;
|
||||
});
|
||||
|
||||
smartRequest.get('menu/dish/list?menu_id=' + $scope.selectMenuItemParams.currentMenu + '&parent_id=' + $scope.selectMenuItemParams.currentFolder, function (data) {
|
||||
$scope.selectMenuItemParams.items = data.dishes;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.upMenuItem = function() {
|
||||
if($scope.selectMenuNavigationStack.length > 1) {
|
||||
$scope.selectMenuNavigationStack.pop();
|
||||
var page = $scope.selectMenuNavigationStack.pop();
|
||||
|
||||
if(page.type === 'menu') {
|
||||
$scope.openMenuItem(page.value);
|
||||
}
|
||||
|
||||
if(page.type === 'folder') {
|
||||
$scope.openFolderItem(page.value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$scope.selectMenuItem();
|
||||
}
|
||||
};
|
||||
/* END MENU BLOCK */
|
||||
|
||||
/* CLIENT BLOCK */
|
||||
$scope.selectClientItemParams = {
|
||||
clients: [],
|
||||
groups: [],
|
||||
isParent: true
|
||||
};
|
||||
|
||||
$scope.selectClientItem = function() {
|
||||
$scope.selectClientItemParams = {
|
||||
clients: [],
|
||||
groups: [],
|
||||
isParent: true
|
||||
};
|
||||
$scope.currentPage = 1;
|
||||
$scope.pages = 1;
|
||||
smartRequest.get('v1/clientgroup', function(data) {
|
||||
$scope.selectClientItemParams.groups = data.groups;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openGroup = function(group) {
|
||||
$scope.selectClientItemParams.isParent = false;
|
||||
$scope.currentGroup = group.id;
|
||||
$scope.currentPage = 1;
|
||||
$scope.selectClientItemParams.groups = [];
|
||||
$scope.selectClientItemParams.clients = [];
|
||||
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function(data) {
|
||||
$scope.selectClientItemParams.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.pager = function(currentPage) {
|
||||
$scope.selectClientItemParams.isParent = false;
|
||||
$scope.selectClientItemParams.groups = [];
|
||||
$scope.selectClientItemParams.clients = [];
|
||||
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function(data) {
|
||||
$scope.selectClientItemParams.clients = data.clients;
|
||||
$scope.pages = data.pages;
|
||||
$scope.currentGroup = data.currentGroup;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.upGroup = function() {
|
||||
$scope.selectClientItemParams = {
|
||||
clients: [],
|
||||
groups: [],
|
||||
isParent: true
|
||||
};
|
||||
|
||||
smartRequest.get('v1/clientgroup', function(data) {
|
||||
$scope.selectClientItemParams.groups = data.groups;
|
||||
});
|
||||
};
|
||||
/* END CLIENT BLOCK */
|
||||
|
||||
$scope.selectItem = function(value, type, info) {
|
||||
$scope.selectedElement.value = value;
|
||||
$scope.selectedElement.type = type;
|
||||
$scope.selectedElement.info = info;
|
||||
};
|
||||
|
||||
$scope.editTermParam = function(param) {
|
||||
$scope.$eval(param.type[0].toLowerCase() + param.type.slice(1) + '()');
|
||||
|
||||
$scope.selectedElement = {
|
||||
type: param.type,
|
||||
value: param.value,
|
||||
currentModal: '#edit-' + param.type.toLowerCase(),
|
||||
param: param,
|
||||
info: param.info,
|
||||
subtype: param.subtype
|
||||
};
|
||||
|
||||
$($scope.selectedElement.currentModal).modal();
|
||||
};
|
||||
|
||||
$scope.confirmSelect = function() {
|
||||
$($scope.selectedElement.currentModal).modal('toggle');
|
||||
|
||||
$scope.selectedElement.param.value = $scope.selectedElement.value;
|
||||
$scope.selectedElement.param.info = $scope.selectedElement.info;
|
||||
$scope.selectedElement.param.subtype = $scope.selectedElement.type;
|
||||
};
|
||||
|
||||
$scope.update();
|
||||
|
||||
smartRequest.get('discount/type/list', function(data) {
|
||||
$scope.terms = data.discount_types;
|
||||
$scope.defaultTerm = data.default.code;
|
||||
});
|
||||
|
||||
smartRequest.get('menu/readonly', function (data) {
|
||||
$scope.readonlyMode = data.readonly;
|
||||
|
||||
if (data.readonly) {
|
||||
Notification.error('Режим просмотра!');
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
@@ -20,6 +20,13 @@ item: [
|
||||
icon: 'dashboard',
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
name: 'Loyalty (dev)',
|
||||
acl: 'loyalty',
|
||||
url: 'app.loyalty',
|
||||
icon: 'dashboard',
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
name: 'Гости',
|
||||
acl: 'clients',
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
controller: 'RoommapCtrl',
|
||||
resolve: ['scripts/controllers/roommap.js']
|
||||
},
|
||||
{
|
||||
code: 'app.loyalty',
|
||||
url: '/v1/loyalty',
|
||||
templateUrl: '../views/loyalty/index.html',
|
||||
data: { title : 'Loyalty' },
|
||||
controller: 'LoyaltyCtrl',
|
||||
resolve: ['scripts/controllers/loyalty.js']
|
||||
},
|
||||
{
|
||||
code: 'app.clients',
|
||||
url: '/clients',
|
||||
|
||||
BIN
web/views/clients/images/client.png
Normal file
BIN
web/views/clients/images/client.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
@@ -1,8 +1,10 @@
|
||||
<div id="container-floating">
|
||||
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Сформировать файл" ng-click="createClientFile()" style="background-color: #3c80f6" onmouseenter="$(this).tooltip('show')">
|
||||
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Сформировать файл"
|
||||
ng-click="createClientFile()" style="background-color: #3c80f6" onmouseenter="$(this).tooltip('show')">
|
||||
<i class="material-icons">cloud_download</i>
|
||||
</div>
|
||||
<div id="floating-button" data-toggle="tooltip" data-placement="left" title="Действия" onmouseenter="$(this).tooltip('show')">
|
||||
<div id="floating-button" data-toggle="tooltip" data-placement="left" title="Действия"
|
||||
onmouseenter="$(this).tooltip('show')">
|
||||
<p class="plus"><i class="material-icons"></i></p>
|
||||
<p class="edit"><i class="material-icons"></i></p>
|
||||
</div>
|
||||
@@ -17,8 +19,9 @@
|
||||
<div class="row-body scrollable hover">
|
||||
<div class="row-inner">
|
||||
<div class="nav nav-pills nav-stacked m-t-sm menus">
|
||||
<a class="nav-link no_selection" ng-repeat="group in groups" sglclick="openGroup(group)" ios-dblclick="editGroup(group)"
|
||||
ng-class="group.id == currentGroup ? 'bold-line' : ''">
|
||||
<a class="nav-link no_selection" ng-repeat="group in groups" sglclick="openGroup(group)"
|
||||
ios-dblclick="editGroup(group)"
|
||||
ng-class="group.id == currentGroup ? 'bold-line' : ''">
|
||||
<span ng-class="group.id == currentGroup ? 'bold' : ''">{{ group.name }}</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -29,8 +32,8 @@
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="openFormCreateGroup()">
|
||||
<i class="fa fa-plus fa-fw m-r-xs"></i>Группа
|
||||
</a>
|
||||
<p></p>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="openFormCreateBarcode()">
|
||||
<p></p>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="openFormCreateBarcode()">
|
||||
<i class="fa fa-plus fa-fw m-r-xs"></i>Дисконтные карты
|
||||
</a>
|
||||
</div>
|
||||
@@ -44,8 +47,9 @@
|
||||
<span class="input-group-addon no-border no-bg">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<input type="text" class="form-control no-border no-bg" placeholder="Поиск гостей..." ng-keyup="clientsSearch()"
|
||||
ng-model="search.query">
|
||||
<input type="text" class="form-control no-border no-bg" placeholder="Поиск гостей..."
|
||||
ng-keyup="clientsSearch()"
|
||||
ng-model="search.query">
|
||||
<span class="input-group-addon no-border no-bg search-clear" ng-click="clearSearchInput()">
|
||||
<i class="fa fa-times"></i>
|
||||
</span>
|
||||
@@ -57,8 +61,8 @@
|
||||
<div class="row-inner">
|
||||
<div class="list">
|
||||
<div class="list-item pointer no_selection" ng-repeat="client in clients"
|
||||
sglclick="openClientInfo(client)" ios-dblclick="editClient(client, currentGroup)"
|
||||
ng-class="client.id == currentClientId ? 'active' : ''">
|
||||
sglclick="openClientInfo(client)" ios-dblclick="editClient(client, currentGroup)"
|
||||
ng-class="client.id == currentClientId ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;">person</i>
|
||||
@@ -74,18 +78,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-a text-center">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage === 1}" ng-click="pager(currentPage=currentPage-1)"><</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage}">{{currentPage}}/{{pages}}</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage === pages}" ng-click="pager(currentPage=currentPage+1)">></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-a text-center">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info"
|
||||
ng-class="{disabled:currentPage === 1}" ng-click="pager(currentPage=currentPage-1)"><</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage}">{{currentPage}}/{{pages}}</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info"
|
||||
ng-class="{disabled:currentPage === pages}" ng-click="pager(currentPage=currentPage+1)">></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-click="openFormCreateClient()">
|
||||
<i class="fa fa-plus fa-fw m-r-xs"></i>Гость
|
||||
</a>
|
||||
<p></p>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,203 +99,335 @@
|
||||
<div class="col-sm-7">
|
||||
<div class="padding" ng-if="currentClientId > 0">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h2 class="text-center">{{currentClient.name}}</h2>
|
||||
<h3 class="text-muted m-t">
|
||||
<div class="col-sm-4 text-center">{{currentClient.info.address}}</div>
|
||||
<div class="col-sm-4 text-center">{{currentClient.info.phone}}</div>
|
||||
<div class="col-sm-4 text-center">{{currentClient.info.email}}</div>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body b-t m-t">
|
||||
{{currentClient.info.order_count}} заказов на сумму {{currentClient.info.order_sum}}
|
||||
<hr>
|
||||
<div class="table-responsive" ng-if="orders.length > 0">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Открыт</th>
|
||||
<th>Закрыт</th>
|
||||
<th class="text-right">Сумма заказа</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="order in orders" ng-click="getItems(order)">
|
||||
<td>{{ order.opened }}</td>
|
||||
<td>{{ order.closed }}</td>
|
||||
<td class="text-right">{{ order.sum }} BYN</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewGroup">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание новой группы</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="closeCard()">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createGroupForm" ng-submit="createGroup()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Название</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newGroup.name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="item">
|
||||
<div class="p-a-md">
|
||||
<div class="row m-t">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right" ng-disabled="createGroupForm.$invalid">Создать</button>
|
||||
<a href="" class="pull-left m-r-md">
|
||||
<span class="avatar w-96">
|
||||
<img src="../views/clients/images/client.png">
|
||||
<i class="on b-white"></i>
|
||||
</span>
|
||||
</a>
|
||||
<div class="clear m-b">
|
||||
<h3 class="m-0 m-b-xs">{{currentClient.name}}</h3>
|
||||
<p class="text-muted">
|
||||
<span class="m-r">
|
||||
<i class="fa fa-phone m-r-sm text-muted"></i>{{currentClient.info.phone}}
|
||||
</span>
|
||||
<small>
|
||||
<i class="fa fa-map-marker m-r-xs"></i>{{currentClient.info.address}}
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="p-y text-center text-sm-center col-sm-12">
|
||||
<a href="" class="inline p-x text-center">
|
||||
<span class="h5 block m-0">{{currentClient.info.order_sum}} BYN</span>
|
||||
<small class="text-xs text-muted">Сумма заказов</small>
|
||||
</a>
|
||||
<a href="" class="inline p-x b-l text-center">
|
||||
<span class="h5 block m-0">{{currentClient.info.order_count}}</span>
|
||||
<small class="text-xs text-muted">Кол-во заказов</small>
|
||||
</a>
|
||||
<a href="" class="inline p-x b-l b-r text-center"
|
||||
ng-if="currentClient.info.presale > 0">
|
||||
<span class="h5 block m-0">{{currentClient.info.presale}} BYN</span>
|
||||
<small class="text-xs text-muted">Аванс</small>
|
||||
</a>
|
||||
<a href="" class="inline p-x text-center" ng-if="currentClient.info.bonus > 0">
|
||||
<span class="h5 block m-0">{{currentClient.info.bonus}}</span>
|
||||
<small class="text-xs text-muted">Бонусы</small>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewBarcode">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание дисконтных карт</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="closeCard()">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createBarcodeForm" ng-submit="createBarcode()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Выберите группу</label>
|
||||
<div class="col-sm-9">
|
||||
<select ng-model="newBarcode.group_id" class="form-control" ng-required="true">
|
||||
<option ng-repeat="group in groups" value="{{ group.id }}">{{group.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Первый штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newBarcode.start" placeholder="200000000001" required>
|
||||
<div class="dker p-x">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-sm-9">
|
||||
<div class="p-y-md clearfix nav-active-primary">
|
||||
<ul class="nav nav-pills nav-sm">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="" data-toggle="tab" data-target="#tab_1"
|
||||
aria-expanded="true">Журнал действий</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="" data-toggle="tab" data-target="#tab_2"
|
||||
aria-expanded="false" ng-click="getOrders(currentClient.id)">Заказы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="" data-toggle="tab" data-target="#tab_3"
|
||||
aria-expanded="false">Информация</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Последний штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newBarcode.end" placeholder="200000000999" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right" ng-disabled="createBarcodeForm.$invalid">Создать</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewClient">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание нового гостя</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="padding">
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-lg-12">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane p-v-sm active" id="tab_1" aria-expanded="true">
|
||||
<div class="streamline b-l m-b m-l"
|
||||
style="width:auto;max-height:350px;overflow-y: auto;" ng-if="clientLogs.length > 0">
|
||||
<div class="sl-item b-success" ng-repeat="clientLog in clientLogs">
|
||||
<div class="sl-content" ng-if="clientLog.type == 2">
|
||||
<div class="sl-date text-muted">{{clientLog.time}}</div>
|
||||
<p>{{clientLog.action}} на сумму {{clientLog.value | curr}} BYN
|
||||
пользователем {{clientLog.who}}</p>
|
||||
</div>
|
||||
<div class="sl-content" ng-if="clientLog.type == 1">
|
||||
<div class="sl-date text-muted">{{clientLog.time}}</div>
|
||||
<p>{{clientLog.action}} в количестве {{clientLog.value}} шт</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="streamline b-l m-b m-l"
|
||||
style="width:auto;overflow-y: auto;" ng-if="clientLogs.length == 0">
|
||||
<div class="sl-item">
|
||||
<div class="sl-content">
|
||||
<p>Действия отсутствуют</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane p-v-sm" id="tab_2" aria-expanded="true">
|
||||
<div class="streamline b-l m-b m-l"
|
||||
style="width:auto;max-height:350px;overflow-y: auto;" ng-if="orders.length > 0">
|
||||
<div class="sl-item b-success" ng-repeat="order in orders">
|
||||
<div class="row align-items-center" style="margin-right: 0px;">
|
||||
<div class="sl-content">
|
||||
<div class="col-lg-12 col-sm-6">
|
||||
<a ng-click="getItems(order.id, order.opened, order.closed)">
|
||||
<div class="sl-date text-muted">Заказ открыт:
|
||||
{{order.opened}}
|
||||
</div>
|
||||
<div class="sl-date text-muted">Заказ закрыт:
|
||||
{{order.closed}}
|
||||
</div>
|
||||
<p>Сумма заказа: {{order.sum | curr}} BYN <span ng-if="order.discount > 0">(Скидка: {{order.discount | curr}} BYN)</span></p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form name="createClientForm" ng-submit="createClient()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Имя</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Телефон</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.phone" ui-mask="+375 (99) 999-99-99">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Адрес</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.address">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Email</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.barcode">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-inline row">
|
||||
<label class="col-sm-3 form-group-label" for="specialPriceCheck">Скидка по себестоимости </label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-group-input" type="checkbox" value="" id="specialPriceCheck" ng-model="newClient.special_price">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right" ng-disabled="createClientForm.$invalid">Создать</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="streamline b-l m-b m-l"
|
||||
style="width:auto;overflow-y: auto;" ng-if="orders.length == 0">
|
||||
<div class="sl-item">
|
||||
<div class="sl-content">
|
||||
<p>Заказы отсутствуют</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane p-v-sm" id="tab_3">
|
||||
<div class="row m-b">
|
||||
<div class="col-xs-10">
|
||||
<small class="text-muted">Телефон:</small>
|
||||
<p>{{currentClient.info.phone}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b">
|
||||
<div class="col-xs-10">
|
||||
<small class="text-muted">Адрес:</small>
|
||||
<p>{{currentClient.info.address}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b">
|
||||
<div class="col-xs-10">
|
||||
<small class="text-muted">Email:</small>
|
||||
<p>{{currentClient.info.email}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewGroup">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание новой группы</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="closeCard()">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createGroupForm" ng-submit="createGroup()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Название</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newGroup.name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right"
|
||||
ng-disabled="createGroupForm.$invalid">Создать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewBarcode">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание дисконтных карт</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="closeCard()">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createBarcodeForm" ng-submit="createBarcode()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Выберите группу</label>
|
||||
<div class="col-sm-9">
|
||||
<select ng-model="newBarcode.group_id" class="form-control" ng-required="true">
|
||||
<option ng-repeat="group in groups" value="{{ group.id }}">{{group.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Первый штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newBarcode.start"
|
||||
placeholder="200000000001" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Последний штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newBarcode.end"
|
||||
placeholder="200000000999" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right"
|
||||
ng-disabled="createBarcodeForm.$invalid">Создать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding" ng-if="isCreateNewClient">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3>Создание нового гостя</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-sm white" ng-click="">
|
||||
<i class="material-icons">clear</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createClientForm" ng-submit="createClient()">
|
||||
<div class="box-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Имя</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Телефон</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.phone"
|
||||
ui-mask="+375 (99) 999-99-99">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Адрес</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.address">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Email</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 form-control-label">Штрих код</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" ng-model="newClient.barcode">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-inline row">
|
||||
<label class="col-sm-3 form-group-label" for="specialPriceCheck">Скидка по
|
||||
себестоимости </label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-group-input" type="checkbox" value="" id="specialPriceCheck"
|
||||
ng-model="newClient.special_price">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dker p-a">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="submit" class="btn success p-x-md pull-right"
|
||||
ng-disabled="createClientForm.$invalid">Создать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="edit-client" data-backdrop="true" ng-if="!readonlyMode">
|
||||
<div ui-include="'../views/clients/edit_client.html'"></div>
|
||||
|
||||
@@ -2,33 +2,68 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h5 class="modal-title">История заказа</h5>
|
||||
<span class="text-muted">{{order.opened}} - {{order.closed}}</span>
|
||||
<p>
|
||||
Номер заказа: <strong>#{{order.order_id}}</strong><br>
|
||||
Время закрытия: <strong>{{order.closed}}</strong><br>
|
||||
Персонал: <strong>{{order.who_close}}</strong><br>
|
||||
Статус заказа: <span class="label success">{{order.order_status}}</span><br>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-body p-lg">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<table class="table table-striped white b-a">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Блюдо</th>
|
||||
<th>Количество</th>
|
||||
<th class="text-right">Сумма, BYN</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Блюдо</th>
|
||||
<th style="width: 80px">Кол-во</th>
|
||||
<th style="width: 140px">Стоимость</th>
|
||||
<th style="width: 180px">Итог</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="item in order.items">
|
||||
<td>{{item.name}}</td>
|
||||
<td>{{item.count}}</td>
|
||||
<td class="text-right">{{item.amount}}</td>
|
||||
</tr>
|
||||
<tr ng-repeat="item in order.items">
|
||||
<td>{{item.id}}</td>
|
||||
<td>{{item.name}}</td>
|
||||
<td>{{item.count * item.cof}}</td>
|
||||
<td>{{item.price | curr}} BYN</td>
|
||||
<td>{{item.amount | curr}} BYN <p ng-if="item.discount > 0">
|
||||
<span>(Скидка: {{item.discount}}%)</span></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right"><strong>Итого</strong></td>
|
||||
<td>{{order.amount | curr}} BYN</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right no-border" ng-if="order.full_price - order.amount > 0">
|
||||
<strong>Сумма скидки</strong></td>
|
||||
<td ng-if="order.full_price - order.amount > 0">{{order.full_price - order.amount | curr}} BYN
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-right no-border"><strong>Оплачено:</strong></td>
|
||||
</tr>
|
||||
<tr ng-if="order.cash > 0">
|
||||
<td colspan="5" class="text-right no-border">Наличные: <strong>{{order.cash
|
||||
| curr}} BYN</strong></td>
|
||||
</tr>
|
||||
<tr ng-if="order.credit > 0">
|
||||
<td colspan="5" class="text-right no-border">Кред. карта: <strong>{{order.credit | curr}}
|
||||
BYN</strong></td>
|
||||
</tr>
|
||||
<tr ng-if="order.clearing > 0">
|
||||
<td colspan="5" class="text-right no-border">Питание штата: <strong>{{order.clearing | curr}}
|
||||
BYN</strong>
|
||||
</tr>
|
||||
<tr ng-if="order.presale > 0">
|
||||
<td colspan="5" class="text-right no-border">Зачтен аванс: <strong>{{order.presale | curr}}
|
||||
BYN</strong></td>
|
||||
</tr>
|
||||
<tr ng-if="order.self > 0">
|
||||
<td colspan="5" class="text-right no-border">Безнал: <strong>{{order.self | curr}} BYN</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"></th>
|
||||
<th class="text-right">Итого: {{ order.amount | curr }} BYN</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<div class="col-sm-6 col-md-4 one-height">
|
||||
<div class="box">
|
||||
<div class="box-header danger">
|
||||
<h3>Удаления</h3>
|
||||
<h3>Удаления: {{deleted}}</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-tool box-tool-white">
|
||||
@@ -123,11 +123,10 @@
|
||||
<div class="box-body b-t">
|
||||
<h4 class="m-a-0 text-md" ng-if="deleted > 0">
|
||||
<a>
|
||||
{{deleted}}
|
||||
<span class="text-sm">на сумму</span> {{deleted_sum | curr}}
|
||||
<span class="text-sm lead"><strong>Сумма: {{deleted_sum | curr}} BYN</strong></span>
|
||||
</a>
|
||||
</h4>
|
||||
<span class="text-muted" ng-if="deleted == 0">Удаленных позиций нет</h4>
|
||||
<span class="text-muted" ng-if="deleted == 0">Удаленных позиций нет</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -136,7 +135,7 @@
|
||||
<div class="box">
|
||||
<div class="box-header primary">
|
||||
<h3>
|
||||
Заказы со скидками
|
||||
Заказы со скидками: {{discounts}}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
@@ -153,11 +152,10 @@
|
||||
<div class="box-body b-t">
|
||||
<h4 class="m-a-0 text-md" ng-if="discounts > 0">
|
||||
<a>
|
||||
{{discounts}}
|
||||
<span class="text-sm">на сумму </span> {{tot_disc_sum | curr}}
|
||||
<span class="text-sm lead"><strong>Сумма: {{tot_disc_sum | curr}} BYN</strong></span>
|
||||
</a>
|
||||
</h4>
|
||||
<span class="text-muted" ng-if="discounts == 0">Заказов со скидками нет</h4>
|
||||
<span class="text-muted" ng-if="discounts == 0">Заказов со скидками нет</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,10 +183,9 @@
|
||||
<h4 class="m-a-0 text-md" ng-if="namedGuests > 0">
|
||||
<a>
|
||||
<span class="text-sm lead"><strong>Сумма заказов: {{sumNamedGuests | curr}} BYN</strong></span>
|
||||
|
||||
</a>
|
||||
</h4>
|
||||
<span class="text-muted" ng-if="namedGuests == 0">Именованных гостей нет</h4>
|
||||
<span class="text-muted" ng-if="namedGuests == 0">Именованных гостей нет</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
32
web/views/loyalty/create.html
Normal file
32
web/views/loyalty/create.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Создание скидки</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<form role="form" class="ng-pristine ng-valid container">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12"><input class="form-control" placeholder="Название" type="text" ng-model="currentDiscount.name"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<select class="form-control" ng-model="currentDiscount.value_type">
|
||||
<option value="0">Процент</option>
|
||||
<option value="1">Сумма</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" placeholder="Значение" type="text" ng-model="currentDiscount.value">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn success p-x-md" ng-click="create()">Создать</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
234
web/views/loyalty/edit.html
Normal file
234
web/views/loyalty/edit.html
Normal file
@@ -0,0 +1,234 @@
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Редактирование скидки</h5>
|
||||
</div>
|
||||
<div class="modal-body text-center p-lg">
|
||||
<form role="form" class="ng-pristine ng-valid container">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<input class="form-control" placeholder="Название" type="text" ng-model="currentDiscount.name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<select class="form-control" ng-model="currentDiscount.value_type">
|
||||
<option value="0">Процент</option>
|
||||
<option value="1">Сумма</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" placeholder="Значение" type="text" ng-model="currentDiscount.value">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row" style="text-align: left">
|
||||
<div class="col-sm-12">
|
||||
<div class="checkbox-group" style="display: inline-block; width: auto; margin-right: 50px">
|
||||
<label class="ui-switch ui-switch-md m-t-xs">
|
||||
<input type="checkbox" ng-model="currentDiscount.is_enable">
|
||||
<i></i>
|
||||
</label>
|
||||
|
||||
<label class="ui-switch-info">Активна</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-group" style="display: inline-block; width: auto">
|
||||
<label class="ui-switch ui-switch-md m-t-xs">
|
||||
<input type="checkbox" ng-model="currentDiscount.is_check_all">
|
||||
<i></i>
|
||||
</label>
|
||||
|
||||
<label class="ui-switch-info">Проверять все условия</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<label>Время действия скидки</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class='input-group date' ui-jp="datetimepicker" ui-options="{
|
||||
format: 'DD.MM.YYYY',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-screenshot',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
}
|
||||
}">
|
||||
<input type='text' class="form-control" placeholder="С" ng-model="currentDiscount.start_date" />
|
||||
<span class="input-group-addon">
|
||||
<i class="material-icons"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class='input-group date' ui-jp="datetimepicker" ui-options="{
|
||||
format: 'DD.MM.YYYY',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-screenshot',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
}
|
||||
}">
|
||||
<input type='text' class="form-control" placeholder="По" ng-model="currentDiscount.end_date" />
|
||||
<span class="input-group-addon">
|
||||
<i class="material-icons"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group row">
|
||||
<label>Условия</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-9">
|
||||
<select ng-model="currentDiscount.new_term_type" class="form-control">
|
||||
<option ng-repeat="term in terms" value="{{ term.code }}">{{ term.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<button class="btn" style="width: 100%" ng-click="addTerm()">Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row" ng-repeat="term in currentTerms">
|
||||
<div class="col-sm-12">
|
||||
<div class="term-item">
|
||||
<div style="height: 30px" class="term-header" onclick="toggleTerm(this)">
|
||||
<strong>
|
||||
<i class="material-icons term-icon"></i> {{ term.discount_type_name }}</strong>
|
||||
<button class="btn btn-xs btn-danger pull-right" ng-click="askDeleteTerm(term)" onclick="event.stopPropagation()">
|
||||
<i class="material-icons"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="term-content">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-{{ 12 / term.params.length }}" ng-repeat="param in term.params">
|
||||
<label>{{ param.name }}</label>
|
||||
|
||||
<input type="text" class="form-control" ng-model="param.value" ng-if="param.type == 'Integer'" />
|
||||
|
||||
<select class="form-control" ng-model="param.value" ng-if="param.type == 'Select'">
|
||||
<option value="">Выбрать</option>
|
||||
<option ng-repeat="option in param.options" value="{{ option.code }}">{{ option.name }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<div ng-if="param.type == 'Time'" class='input-group date' ui-jp="datetimepicker" style="border-right: 1px solid rgba(120, 130, 140, 0.2)"
|
||||
ui-options="{
|
||||
format: 'LT',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-screenshot',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
}
|
||||
}">
|
||||
<input type='text' class="form-control" ng-model="param.value" />
|
||||
|
||||
<span class="input-group-addon">
|
||||
<i class="material-icons"></i>
|
||||
</span>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.date').on('dp.change', function () {
|
||||
$(this).find('input').trigger('change');
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div ng-if="param.type == 'SelectMenuItem' || param.type == 'SelectClientItem'">
|
||||
<div class="row">
|
||||
<div class="col-sm-9" style="padding-right: 0">
|
||||
<div style="border: 1px solid #efefef; min-height: 38px" class="form-control">
|
||||
{{ param.info }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3" style="padding-left: 0">
|
||||
<button class="btn" style="width: 100%" ng-click="editTermParam(param)">
|
||||
<i class="material-icons"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group" style="text-align: left">
|
||||
<div class="checkbox-group">
|
||||
<label class="ui-switch danger ui-switch-md m-t-xs">
|
||||
<input type="checkbox" ng-model="term.is_term">
|
||||
<i></i>
|
||||
</label>
|
||||
|
||||
<label class="ui-switch-info">Исключающее условие</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn danger p-x-md pull-left" data-toggle="modal" data-target="#edit-discount-confirm-delete">
|
||||
<i class="material-icons"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn success p-x-md" ng-click="save()">Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggleTerm(el) {
|
||||
var content = $(el).parent().find('.term-content');
|
||||
|
||||
if (content.css('display') !== 'block') {
|
||||
content.slideDown('normal');
|
||||
}
|
||||
else {
|
||||
content.slideUp('fast');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
79
web/views/loyalty/index.html
Normal file
79
web/views/loyalty/index.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<div id="container-floating">
|
||||
<div class="nd3 nds" data-toggle="tooltip" data-placement="left" title="Добавить" ng-click="add()" ng-if="!readonlyMode" style="background-color: #3c80f6" onmouseenter="$(this).tooltip('show')">
|
||||
<i class="material-icons"></i>
|
||||
</div>
|
||||
|
||||
<div class="nd1 nds" data-toggle="tooltip" data-placement="left" title="Обновить" ng-click="update()" style="background-color: #d3a411" onmouseenter="$(this).tooltip('show')">
|
||||
<i class="material-icons"></i>
|
||||
</div>
|
||||
|
||||
<div id="floating-button" data-toggle="tooltip" data-placement="left" title="Действия" onmouseenter="$(this).tooltip('show')">
|
||||
<p class="plus"><i class="material-icons"></i></p>
|
||||
<p class="edit"><i class="material-icons"></i></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="padding">
|
||||
<div class="box">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered m-a-0 table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th style="width: 120px; text-align: center">Значение</th>
|
||||
<th style="width: 80px; text-align: center">Условия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="discount in discounts" ng-click="edit(discount)">
|
||||
<td>{{ discount.name }}</td>
|
||||
<td style="text-align: center">{{ discount.value_type == 0 ? discount.value + '%' : discount.value + ' BYN' }}</td>
|
||||
<td style="text-align: center">{{ discount.terms_count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="new-discount" data-backdrop="true" ng-if="!readonlyMode">
|
||||
<div ui-include="'../views/discounts/create.html'"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="edit-discount" data-backdrop="true" ng-if="!readonlyMode">
|
||||
<div ui-include="'../views/discounts/edit.html'"></div>
|
||||
</div>
|
||||
|
||||
<div id="edit-discount-confirm-delete" class="modal confirm-box" data-backdrop="true" style="z-index: 1052">
|
||||
<div class="bottom white b-b" style="height: 90px">
|
||||
<div class="confirm-box-body p-lg">
|
||||
<p>Вы действительно хотите удалить скидку?</p>
|
||||
</div>
|
||||
|
||||
<div class="confirm-box-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
|
||||
<button type="button" class="btn danger p-x-md" ng-click="delete()">Да</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="edit-term-confirm-delete" class="modal confirm-box" data-backdrop="true" style="z-index: 1052">
|
||||
<div class="bottom white b-b" style="height: 90px">
|
||||
<div class="confirm-box-body p-lg">
|
||||
<p>Вы действительно хотите удалить условие скидки?</p>
|
||||
</div>
|
||||
|
||||
<div class="confirm-box-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Нет</button>
|
||||
<button type="button" class="btn danger p-x-md" ng-click="deleteTerm()">Да</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="edit-selectmenuitem" data-backdrop="true" style="z-index: 1052">
|
||||
<div ui-include="'../views/discounts/terms/selectmenuitem.html'"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="edit-selectclientitem" data-backdrop="true" style="z-index: 1052">
|
||||
<div ui-include="'../views/discounts/terms/selectclientitem.html'"></div>
|
||||
</div>
|
||||
65
web/views/loyalty/terms/selectclientitem.html
Normal file
65
web/views/loyalty/terms/selectclientitem.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<div class="modal-dialog modal-list">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Выбор клиента</h5>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-lg">
|
||||
<div ng-if="selectClientItemParams.isParent == false">
|
||||
<div class="list-item pointer no_selection" ios-dblclick="upGroup()">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list inset" ng-repeat="group in selectClientItemParams.groups">
|
||||
<div class="list-item pointer no_selection" sglclick="selectItem(group.id, 'client_group', group.name)"
|
||||
ios-dblclick="openGroup(group)"
|
||||
ng-class="group.id == selectedElement.value && selectedElement.type == 'client_group' ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">
|
||||
{{ group.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list inset" ng-repeat="client in selectClientItemParams.clients">
|
||||
<div class="list-item pointer no_selection" ng-click="selectItem(client.id, 'client', client.name)"
|
||||
ng-class="client.id == selectedElement.value && selectedElement.type == 'client' ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">
|
||||
{{ client.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-a text-center">
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage === 1}" ng-click="pager(currentPage=currentPage-1)"><</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage}">{{currentPage}}/{{pages}}</a>
|
||||
<a class="btn btn-md btn-outline rounded b-info text-info" ng-class="{disabled:currentPage === pages}" ng-click="pager(currentPage=currentPage+1)">></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn success p-x-md" ng-disabled="selectedElement.value == 0"
|
||||
ng-click="confirmSelect()">Выбрать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
82
web/views/loyalty/terms/selectmenuitem.html
Normal file
82
web/views/loyalty/terms/selectmenuitem.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<div class="modal-dialog modal-list">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Выбор элемента меню</h5>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-lg">
|
||||
<div ng-if="selectMenuItemParams.currentMenu > 0">
|
||||
<div class="list-item pointer no_selection" ios-dblclick="upMenuItem()">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="selectMenuItemParams.currentMenu == 0">
|
||||
<div class="list inset" ng-repeat="menu in selectMenuItemParams.menus">
|
||||
<div class="list-item pointer no_selection" ios-dblclick="openMenuItem(menu)"
|
||||
sglclick="selectItem(menu.id, 'menu', menu.name)"
|
||||
ng-class="menu.id == selectedElement.value && selectedElement.type == 'menu' ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">
|
||||
{{ menu.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="selectMenuItemParams.currentMenu > 0">
|
||||
<div class="list inset" ng-repeat="folder in selectMenuItemParams.folders">
|
||||
<div class="list-item pointer no_selection" ios-dblclick="openFolderItem(folder)"
|
||||
sglclick="selectItem(folder.id, 'folder', folder.name)"
|
||||
ng-class="folder.id == selectedElement.value && selectedElement.type == 'folder' ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body" style="line-height: 30px">
|
||||
{{ folder.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="selectMenuItemParams.currentMenu > 0">
|
||||
<div class="list inset" ng-repeat="item in selectMenuItemParams.items">
|
||||
<li class="list-item pointer no_selection" ng-click="selectItem(item.id, 'item', item.name)"
|
||||
ng-class="item.id == selectedElement.value && selectedElement.type == 'item' ? 'active' : ''">
|
||||
<div class="list-left">
|
||||
<span class="w-30">
|
||||
<i class="material-icons" style="font-size: 30px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-body">
|
||||
{{ item.name }} <span class="text-muted">#{{ item.code }}</span>
|
||||
<small class="block text-muted">{{ item.cosht | curr }} BYN</small>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn success p-x-md" ng-disabled="selectedElement.value == 0"
|
||||
ng-click="confirmSelect()">Выбрать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user