Added voicenumber select in Order
This commit is contained in:
@@ -28,6 +28,15 @@ class VoicenumberblockController extends mfBaseController {
|
||||
$filter = $this->getPreparedFilter($filter);
|
||||
}
|
||||
|
||||
$num_from = [];
|
||||
$num_from_start = $this->request->nf;
|
||||
$num_from_block = $this->request->nfb;
|
||||
|
||||
if($num_from_start && $num_from_block) {
|
||||
$num_from[$num_from_block] = $num_from_start;
|
||||
}
|
||||
$this->layout()->set("num_from", $num_from);
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
@@ -124,4 +133,41 @@ class VoicenumberblockController extends mfBaseController {
|
||||
$this->redirect("Voicenumberblock");
|
||||
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
$data = [];
|
||||
|
||||
switch($do) {
|
||||
case "getFreeNumbers":
|
||||
$return = $this->getFreeNumbersApi();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
|
||||
if(!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
private function getFreeNumbersApi() {
|
||||
$block_id = $this->request->id;
|
||||
if(!is_numeric($block_id) || $block_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$block = new Voicenumberblock($block_id);
|
||||
if(!$block->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$free = $block->getFreeNumbers();
|
||||
|
||||
return ["numbers" => $free];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user