48 lines
1.9 KiB
PHP
48 lines
1.9 KiB
PHP
<?
|
|
namespace admin\controls;
|
|
|
|
class ShopStatuses {
|
|
|
|
// status_save
|
|
public static function status_save()
|
|
{
|
|
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania statusu wystąpił błąd. Proszę spróbować ponownie.' ];
|
|
$values_tmp = json_decode( \S::get( 'values' ), true );
|
|
|
|
$values = [];
|
|
|
|
foreach ( $values_tmp as $item )
|
|
{
|
|
$name = $item['name'];
|
|
$value = $item['value'];
|
|
$keys = \S::parse_name( $name );
|
|
\S::set_array_value( $values, $keys, $value );
|
|
}
|
|
|
|
if ( $id = \admin\factory\ShopStatuses::status_save( $values['id'], $values['color'], $values['apilo_status_id'], $values['sellasist_status_id'], $values['baselinker_status_id'] ) )
|
|
$response = [ 'status' => 'ok', 'msg' => 'Status został zapisany.', 'id' => $id ];
|
|
|
|
echo json_encode( $response );
|
|
exit;
|
|
}
|
|
|
|
// status_edit
|
|
public static function status_edit()
|
|
{
|
|
return \Tpl::view( 'shop-statuses/status-edit', [
|
|
'status' => \admin\factory\ShopStatuses::get_status( \S::get( 'id' ) ),
|
|
'apilo_order_status_list' => unserialize( \admin\factory\Integrations::apilo_settings( 'status-types-list' ) ),
|
|
'sellasist_order_status_list' => unserialize( \admin\factory\Integrations::sellasist_settings( 'status_types_list' ) ),
|
|
'baselinker_order_status_list' => unserialize( \admin\factory\Integrations::baselinker_settings( 'order_status_list' ) ),
|
|
] );
|
|
}
|
|
|
|
static public function view_list()
|
|
{
|
|
return \Tpl::view( 'shop-statuses/view-list', [
|
|
'apilo_order_status_list' => unserialize( \admin\factory\Integrations::apilo_settings( 'status-types-list' ) ),
|
|
'sellasist_order_status_list' => unserialize( \admin\factory\Integrations::sellasist_settings( 'status_types_list' ) ),
|
|
'baselinker_order_status_list' => unserialize( \admin\factory\Integrations::baselinker_settings( 'order_status_list' ) ),
|
|
] );
|
|
}
|
|
} |