' . Html::encode($relationModel->duration ?: 5) . '
';
+
+$content .= Html::submitButton(
+ $relationModel->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'),
+ ['class' => 'btn btn-primary']
+);
+echo Card::widget([
+ 'title' => '',
+ 'content' => $content,
+]);
+ActiveForm::end();
+// Include JavaScript to update the display as the slider value changes
+$this->registerJs("
+ function updateDurationValue(value) {
+ document.getElementById('duration-value-display').textContent = value;
+ }
+", \yii\web\View::POS_HEAD);
diff --git a/views/business/_service_widget.php b/views/business/_service_widget.php
deleted file mode 100644
index 600c7074..00000000
--- a/views/business/_service_widget.php
+++ /dev/null
@@ -1,51 +0,0 @@
- "ServiceGrid".$model->id, // unique ID for the Pjax widget to target this specific grid
- 'timeout' => 10000, // timeout in milliseconds, adjust as needed
- 'enablePushState' => false, // do not change URL
- 'clientOptions' => ['method' => 'POST'] // use POST method for the requests, adjust as needed
-]);
-
-$slug = $model->slug;
-
-try {
- $content = GridView::widget([
- 'dataProvider' => $dataProvider,
- 'columns' => [
- 'name',
- 'resource_type',
- 'expert_type',
- 'duration',
- [
- 'class' => 'yii\grid\Column',
- 'content' => function ($model, $key, $index, $column) use ($slug) {
- $url2 = MyUrl::to(["user/update/$model->id"]);
- return
- Html::a(Yii::t('app', 'Edit'), $url2, ['class' => 'btn btn-light border border-primary btn-sm mb-1']);
- },
- ],
- ],
- 'pager' => [
- 'class' => yii\bootstrap5\LinkPager::class,
- ],
-
- ]);
-} catch (Throwable $e) {
-}
-
-echo Card::widget([
- 'title' => $model->name.' '.Yii::t('app', 'Services'),
- 'content' => $content,
-]);
-
-Pjax::end();
-
diff --git a/views/business/_user_widget.php b/views/business/_user_widget.php
index 809c8e4e..52ec58c5 100644
--- a/views/business/_user_widget.php
+++ b/views/business/_user_widget.php
@@ -10,10 +10,10 @@
/** @var \app\models\Business $model */
Pjax::begin([
- 'id' => "UsersGrid".$model->id, // unique ID for the Pjax widget to target this specific grid
- 'timeout' => 10000, // timeout in milliseconds, adjust as needed
- 'enablePushState' => false, // do not change URL
- 'clientOptions' => ['method' => 'POST'] // use POST method for the requests, adjust as needed
+ 'id' => "UsersGrid".$model->id,
+ 'timeout' => 10000,
+ 'enablePushState' => false,
+ 'clientOptions' => ['method' => 'POST']
]);
$slug = $model->slug;
diff --git a/views/business/business_relations.php b/views/business/business_relations.php
new file mode 100644
index 00000000..22f522a7
--- /dev/null
+++ b/views/business/business_relations.php
@@ -0,0 +1,30 @@
+title = Html::encode($model->name).' '.$relationTitle;
+?>
+
+
+
+ = $this->render('_relation_widget', [
+ 'model' => $model,
+ 'dataProvider' => $dataProvider,
+ 'relationColumns' => $relationColumns,
+ 'relationTitle' => $relationTitle,
+ 'relation' => $relation
+ ])
+ ?>
+ = $this->render("_{$relation}_form", ['model' => $model, 'relationModel' => $relationModel]) ?>
+ = (!$relationModel->isNewRecord) ? Html::a($relationCreateTitle, MyUrl::to(["business/$relation/$model->slug"]), ['class' => 'btn btn-primary']) : '' ?>
+
+
diff --git a/views/business/business_resources.php b/views/business/business_resources.php
deleted file mode 100644
index f3b2e561..00000000
--- a/views/business/business_resources.php
+++ /dev/null
@@ -1,17 +0,0 @@
-title = Html::encode($model->name).' '.Yii::t('app', 'Resources');
-?>
-
-
-
- = $this->render('_resource_widget', ['model' => $model, 'dataProvider' => $dataProvider]) ?>
-render('_resource_search_widget', ['model' => $model]) ?> */ ?>
- = Html::a(Yii::t('app', 'Add Resource'), MyUrl::to(["resource/create/$model->slug"]), ['class' => 'btn btn-primary btn-outline-light']) ?>
-
-
diff --git a/views/business/business_rules.php b/views/business/business_rules.php
deleted file mode 100644
index 446b6212..00000000
--- a/views/business/business_rules.php
+++ /dev/null
@@ -1,17 +0,0 @@
-title = Html::encode($model->name).' '.Yii::t('app', 'Rules');
-?>
-
-
-
- = $this->render('_rule_widget', ['model' => $model, 'dataProvider' => $dataProvider]) ?>
-render('_resource_search_widget', ['model' => $model]) ?> */ ?>
- = Html::a(Yii::t('app', 'Add Rule'), MyUrl::to(["rule/create/$model->slug"]), ['class' => 'btn btn-primary btn-outline-light']) ?>
-
-
diff --git a/views/business/business_services.php b/views/business/business_services.php
deleted file mode 100644
index 56b34dff..00000000
--- a/views/business/business_services.php
+++ /dev/null
@@ -1,17 +0,0 @@
-title = Html::encode($model->name).' '.Yii::t('app', 'Services');
-?>
-
-
-
- = $this->render('_service_widget', ['model' => $model, 'dataProvider' => $dataProvider]) ?>
-render('_resource_search_widget', ['model' => $model]) ?> */ ?>
- = Html::a(Yii::t('app', 'Add Service'), MyUrl::to(["service/create/$model->slug"]), ['class' => 'btn btn-primary btn-outline-light']) ?>
-
-
diff --git a/views/business/business_users.php b/views/business/business_users.php
index d5d5aff3..c0d321d7 100644
--- a/views/business/business_users.php
+++ b/views/business/business_users.php
@@ -4,7 +4,6 @@
/** @var \app\models\Business $model */
/** @var \yii\data\ActiveDataProvider $dataProvider */
-/** @var string $role */
$this->title = Html::encode($model->name).' '.Yii::t('app', Yii::$app->params['roles'][$role]);
?>