public function run()
 {
     //DB::table('service_categories')->delete();
     // ServiceCategories
     $categories = ['Webhosting', 'Emailhosting', 'Domeinen', 'Onderhoudscontract', 'Strippenkaart', 'Nieuwsbrieven'];
     foreach ($categories as $categorie) {
         ServiceCategory::create(array('name' => $categorie));
     }
 }
Example #2
0
 public function getAllServiceCategories()
 {
     // service cats
     $all_service_categories = ServiceCategory::orderBy('name', 'ASC')->get(['id', 'name']);
     $service_categories = [];
     foreach ($all_service_categories as $category) {
         $service_categories[] = (object) ['value' => $category->id, 'label' => utf8_encode($category->name)];
     }
     return $service_categories;
 }
 function __Construct($dictionary)
 {
     parent::__Construct(get_class());
     $categories = array();
     $list = ServiceCategory::GetAll(array('partnerCode' => Application::PARTNER_CODE, 'parentId' => null), null, $dictionary->getCode());
     foreach ($list as $category) {
         $categories[] = $category->toArray(true);
     }
     $this->jsonData = array('categories' => $categories);
 }
Example #4
0
			<?php 
echo $form->textField($model, 'contact_no', array('class' => 'form-control number_only'));
?>
			<?php 
echo $form->error($model, 'contact_no');
?>
		</div>
	</div>
	<div class="form-group">
		<?php 
echo $form->labelEx($model, 'services', array('class' => 'control-label col-sm-4'));
?>
		<div class="col-sm-8">
			<div class="checkbox">
				<?php 
echo $form->checkboxList($model, 'services', CHtml::listData(ServiceCategory::getMainCategories(), 'id', 'name'), array('style' => 'margin-left: 0'));
?>
				<?php 
echo $form->error($model, 'services');
?>
			</div>
		</div>
	</div>
</div>

	<hr/>
<div class="form-group">
	<?php 
echo $form->labelEx($model, 'remark', array('class' => 'control-label'));
?>
	<?php 
Example #5
0
<?php

$this->breadcrumbs = array('Service');
$menus = array(array('label' => 'Create Service', 'url' => array('create')));
$this->menu = ControllerActionsName::createMenusRoles($menus, $actions);
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('service-item-grid', {\n\t\turl : \$(this).attr('action'),\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
Yii::app()->clientScript->registerScript('ajaxupdate', "\n\$('#service-item-grid a.ajaxupdate').live('click', function() {\n\t\$.fn.yiiGridView.update('service-item-grid', {\n\t\ttype: 'POST',\n\t\turl: \$(this).attr('href'),\n\t\tsuccess: function() {\n\t\t\t\$.fn.yiiGridView.update('service-item-grid');\n\t\t}\n\t});\n\treturn false;\n});\n");
$cat = ServiceCategory::model()->findByPk($model->parent_id);
?>
<h1>Services of <?php 
echo $cat->name;
?>
</h1>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'service-item-grid', 'dataProvider' => $model->searchItems(), 'selectableRows' => 2, 'columns' => array(array('header' => 'S/N', 'type' => 'raw', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'headerHtmlOptions' => array('width' => '30px', 'style' => 'text-align:center;'), 'htmlOptions' => array('style' => 'text-align:center;')), 'name', array('class' => 'CButtonColumn', 'template' => '{up}', 'buttons' => array('up' => array('label' => '', 'url' => 'Yii::app()->createAbsoluteUrl("admin/serviceCategory/up", array("id"=>$data->id))', 'options' => array('class' => 'icon-chevron-up ajaxupdate', 'title' => 'Move up'), 'visible' => '$data->getSibling(false)'))), array('class' => 'CButtonColumn', 'template' => '{down}', 'buttons' => array('down' => array('label' => '', 'url' => 'Yii::app()->createAbsoluteUrl("admin/serviceCategory/down", array("id"=>$data->id))', 'options' => array('class' => 'icon-chevron-down ajaxupdate', 'title' => 'Move down'), 'visible' => '$data->getSibling()'))), array('class' => 'CButtonColumn', 'template' => '{update} {delete}'))));
 function getServices()
 {
     $html = '';
     $categories = ServiceCategory::GetAll(array('partnerCode' => Application::PARTNER_CODE));
     foreach ($categories as $category) {
         if ($category->getLevel() == 3) {
             $services = $this->provider->getServices(true, $category->getId());
             if (count($services) > 0) {
                 $html .= HTML::Tr(HTML::Th(HTML::Encode($category->getFullName()), array('colspan' => 3)));
                 foreach ($services as $service) {
                     $html .= HTML::Tr(HTML::Td(HTML::Encode($service->getName())) . HTML::Td(Format::Money($service->getSalePrice(), $service->getCurrencyCode())) . HTML::Td(Format::Minutes($service->getDuration())));
                 }
             }
         }
     }
     return HTML::Table($html, 'servicesTable');
 }
Example #7
0
 /**
  * [postData - handle company specific posted data]
  * @return [json] [DT compatible object]
  */
 public function postData()
 {
     $Model = $this->modelName;
     // Build our Editor instance and process the data coming from _POST
     global $db;
     $data = Editor::inst($db, 'services')->fields(Field::inst('services.id'), Field::inst('services.name'), Field::inst('services.category_id'), Field::inst('service_categories.name'), Field::inst('services.invoice_periods_id'), Field::inst('invoice_periods.description'), Field::inst('services.status_id'), Field::inst('statuses.description'), Field::inst('services.default_monthly_costs'), Field::inst('services.comment'))->leftJoin('service_categories', 'service_categories.id', '=', 'services.category_id')->leftJoin('statuses', 'statuses.id', '=', 'services.status_id')->leftJoin('invoice_periods', 'invoice_periods.id', '=', 'services.invoice_periods_id')->process($_POST)->data();
     $data['service_categories'] = ServiceCategory::all(['id AS value', 'name AS label']);
     $data['statuses'] = Status::all(['id AS value', 'description AS label']);
     $data['invoice_periods'] = Period::all(['id AS value', 'description AS label']);
     return Response::json($data);
 }
Example #8
0
 public function allServiceCats()
 {
     $all_cats = ServiceCategory::all();
     return $all_cats;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = ServiceCategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * [postModelData - handle company specific posted subscriptions data]
  * @param  [Eloquent model] $model [company model]
  * @return [json] [DT compatible object]
  */
 public function postModelData($model)
 {
     $Model = $this->modelName;
     if (isset($_POST["data"]) && !empty($_POST["data"])) {
         $tot_price_str = $_POST['data']['subscriptions']['total_price'];
         if (empty($tot_price_str)) {
             $subs_id = (int) $_POST['data']['subscriptions']['id'];
             $subscription = Subscription::find($subs_id);
             $tot_price_str = $this->subscriptionTotalPrice($_POST['data']['subscriptions']['subscription_start'], $_POST['data']['subscriptions']['subscription_end'], $_POST['data']['subscriptions']['invoice_periods_id'], $_POST['data']['subscriptions']['price']);
             $_POST['data']['subscriptions']['total_price'] = $tot_price_str;
         }
         //error_log("Le POST".json_encode($_POST['data']['subscriptions']['total_price']));
     }
     // Build our Editor instance and process the data coming from _POST
     global $db;
     $data = Editor::inst($db, 'subscriptions')->fields(Field::inst('subscriptions.id'), Field::inst('subscriptions.company_id'), Field::inst('service_categories.id'), Field::inst('service_categories.name'), Field::inst('subscriptions.service_id'), Field::inst('services.name'), Field::inst('subscriptions.description'), Field::inst('subscriptions.price'), Field::inst('subscriptions.total_price'), Field::inst('subscriptions.subscription_start'), Field::inst('subscriptions.subscription_end')->validator(function ($val, $data, $opts) {
         $date_start = strtotime($data['subscriptions']['subscription_start']);
         $date_end = strtotime($data['subscriptions']['subscription_end']);
         return $date_end > $date_start ? true : "Error: End date precedes start date";
     }), Field::inst('subscriptions.invoice_id'), Field::inst('subscriptions.invoice_periods_id'), Field::inst('invoice_periods.description'), Field::inst('subscriptions.status_id'), Field::inst('statuses.description'), Field::inst('subscriptions.status_date'))->leftJoin('invoice_periods', 'invoice_periods.id', '=', 'subscriptions.invoice_periods_id')->leftJoin('statuses', 'statuses.id', '=', 'subscriptions.status_id')->leftJoin('companies', 'companies.id', '=', 'subscriptions.company_id')->leftJoin('services', 'services.id', '=', 'subscriptions.service_id')->leftJoin('service_categories', 'service_categories.id', '=', 'services.category_id')->process($_POST)->data();
     $data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']);
     $data['services'] = Service::all(['id AS value', 'name AS label']);
     $data['service_categories'] = ServiceCategory::all(['id AS value', 'name AS label']);
     $data['statuses'] = Status::all(['id AS value', 'description AS label']);
     $data['invoice_periods'] = Period::all(['id AS value', 'description AS label']);
     return Response::json($data);
 }
Example #11
0
 public function getSibling($next = true)
 {
     $c = new CDbCriteria();
     if (!$this->parent_id) {
         $c->addCondition('parent_id is null');
     } else {
         $c->compare('parent_id', $this->parent_id);
     }
     if ($next) {
         $c->addCondition('display_order > :odr');
         $c->order = 'display_order ASC';
     } else {
         $c->addCondition('display_order < :odr');
         $c->order = 'display_order DESC';
     }
     $c->params[':odr'] = $this->display_order;
     return ServiceCategory::model()->find($c);
 }
Example #12
0
        <div style="float:left;">
			<?php 
$this->widget('ext.editMe.ExtEditMe', array('model' => $model, 'height' => '250px', 'width' => '700px', 'attribute' => 'description', 'toolbar' => Yii::app()->params['ckeditor_editMe'], 'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html', 'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Images', 'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Flash', 'filebrowserUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', 'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', 'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'));
?>
        </div>
		<?php 
echo $form->error($model, 'description');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'parent_id');
?>
		<?php 
echo $form->dropdownList($model, 'parent_id', CHtml::listData(ServiceCategory::getMainCategories(), 'id', 'name'));
?>
		<?php 
echo $form->error($model, 'parent_id');
?>
	</div>

	<div class="row buttons" style="padding-left: 115px;">
		<a href="<?php 
$this->createUrl('index', array('cat' => $model->parent_id));
?>
" class="btn">Back</a>
		<button type="submit" class="btn"><?php 
echo $model->isNewRecord ? 'Create' : 'Save';
?>
</button>