|
@@ -23,9 +23,6 @@ class Course extends Component
|
|
|
$price,
|
|
$price,
|
|
|
$subscription_price,
|
|
$subscription_price,
|
|
|
$months,
|
|
$months,
|
|
|
- $when,
|
|
|
|
|
- $prices,
|
|
|
|
|
- $type,
|
|
|
|
|
$date_from, $date_to;
|
|
$date_from, $date_to;
|
|
|
|
|
|
|
|
public $categories = array();
|
|
public $categories = array();
|
|
@@ -84,11 +81,6 @@ class Course extends Component
|
|
|
$this->date_to = null;
|
|
$this->date_to = null;
|
|
|
$this->months = array();
|
|
$this->months = array();
|
|
|
$this->enabled = true;
|
|
$this->enabled = true;
|
|
|
- $this->type = 'standard';
|
|
|
|
|
- $this->when = array();
|
|
|
|
|
- $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
|
|
|
|
|
- $this->prices = [];
|
|
|
|
|
- $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
|
|
|
|
|
$this->emit('load-data-table');
|
|
$this->emit('load-data-table');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -190,9 +182,6 @@ class Course extends Component
|
|
|
'price' => currencyToDouble($this->price),
|
|
'price' => currencyToDouble($this->price),
|
|
|
'subscription_price' => currencyToDouble($this->subscription_price),
|
|
'subscription_price' => currencyToDouble($this->subscription_price),
|
|
|
'months' => json_encode($this->months),
|
|
'months' => json_encode($this->months),
|
|
|
- 'type' => $this->type,
|
|
|
|
|
- 'when' => json_encode($this->when),
|
|
|
|
|
- 'prices' => json_encode($this->prices),
|
|
|
|
|
'enabled' => $this->enabled
|
|
'enabled' => $this->enabled
|
|
|
]);
|
|
]);
|
|
|
session()->flash('success','Corso creato');
|
|
session()->flash('success','Corso creato');
|
|
@@ -229,32 +218,6 @@ class Course extends Component
|
|
|
$this->price = formatPrice($course->price);
|
|
$this->price = formatPrice($course->price);
|
|
|
$this->subscription_price = formatPrice($course->subscription_price);
|
|
$this->subscription_price = formatPrice($course->subscription_price);
|
|
|
$this->months = json_decode($course->months);
|
|
$this->months = json_decode($course->months);
|
|
|
- $this->when = array();
|
|
|
|
|
- if ($course->when != null)
|
|
|
|
|
- {
|
|
|
|
|
- foreach(json_decode($course->when) as $z)
|
|
|
|
|
- {
|
|
|
|
|
- $this->when[] = array("day" => $z->day, "from" => $z->from, "to" => $z->to);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $this->prices = array();
|
|
|
|
|
- if ($course->prices != null)
|
|
|
|
|
- {
|
|
|
|
|
- foreach(json_decode($course->prices) as $z)
|
|
|
|
|
- {
|
|
|
|
|
- $this->prices[] = array("course_subscription_id" => $z->course_subscription_id, "price" => $z->price);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
|
|
|
|
|
- }
|
|
|
|
|
- $this->type = $course->type;
|
|
|
|
|
$this->dataId = $course->id;
|
|
$this->dataId = $course->id;
|
|
|
$this->update = true;
|
|
$this->update = true;
|
|
|
$this->add = false;
|
|
$this->add = false;
|
|
@@ -287,9 +250,6 @@ class Course extends Component
|
|
|
'price' => currencyToDouble($this->price),
|
|
'price' => currencyToDouble($this->price),
|
|
|
'subscription_price' => currencyToDouble($this->subscription_price),
|
|
'subscription_price' => currencyToDouble($this->subscription_price),
|
|
|
'months' => json_encode($this->months),
|
|
'months' => json_encode($this->months),
|
|
|
- 'type' => $this->type,
|
|
|
|
|
- 'when' => json_encode($this->when),
|
|
|
|
|
- 'prices' => json_encode($this->prices),
|
|
|
|
|
'enabled' => $this->enabled
|
|
'enabled' => $this->enabled
|
|
|
]);
|
|
]);
|
|
|
session()->flash('success','Corso aggiornato');
|
|
session()->flash('success','Corso aggiornato');
|
|
@@ -358,40 +318,5 @@ class Course extends Component
|
|
|
return redirect()->to('/courses');
|
|
return redirect()->to('/courses');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function setDay($idx, $d)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- if (in_array($d, $this->when[$idx]["day"]))
|
|
|
|
|
- {
|
|
|
|
|
- $i = array_search($d, $this->when[$idx]["day"]);
|
|
|
|
|
- array_splice($this->when[$idx]["day"], $i, 1);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $this->when[$idx]["day"][] = $d;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function addRow()
|
|
|
|
|
- {
|
|
|
|
|
- $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function delRow($idx)
|
|
|
|
|
- {
|
|
|
|
|
- unset($this->when[$idx]);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function addPrice()
|
|
|
|
|
- {
|
|
|
|
|
- $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function delPrice($idx)
|
|
|
|
|
- {
|
|
|
|
|
- unset($this->prices[$idx]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|