Different Widget for Admin, Agent, Sales, Customer. Agent, Sales not yet have widget
This commit is contained in:
parent
9332063c87
commit
b379266973
@ -20,6 +20,11 @@ if (isset($_GET['refresh'])) {
|
||||
r2(getUrl('dashboard'), 's', 'Data Refreshed');
|
||||
}
|
||||
|
||||
$tipeUser = _req("user");
|
||||
if (empty($tipeUser)) {
|
||||
$tipeUser = 'Admin';
|
||||
}
|
||||
$ui->assign('tipeUser', $tipeUser);
|
||||
|
||||
$reset_day = $config['reset_day'];
|
||||
if (empty($reset_day)) {
|
||||
|
@ -18,8 +18,12 @@ $tipeUser = _req("user");
|
||||
if (empty($tipeUser)) {
|
||||
$tipeUser = 'Admin';
|
||||
}
|
||||
if($tipeUser == 'Customer') {
|
||||
$WIDGET_PATH .= DIRECTORY_SEPARATOR. 'customer';
|
||||
}
|
||||
|
||||
$ui->assign('tipeUser', $tipeUser);
|
||||
$max = ORM::for_table('tbl_widgets')->max('position');
|
||||
$max = ORM::for_table('tbl_widgets')->where("user", $tipeUser)->max('position');
|
||||
$max2 = substr_count($config['dashboard_' . $tipeUser], '.') + substr_count($config['dashboard_' . $tipeUser], ',') + 1;
|
||||
if ($max2 > $max) {
|
||||
$max = $max2;
|
||||
@ -36,6 +40,7 @@ if ($action == 'add') {
|
||||
$title = _post('title');
|
||||
$widget = _post('widget');
|
||||
$content = _post('content');
|
||||
print_r($_POST);
|
||||
$d = ORM::for_table('tbl_widgets')->create();
|
||||
$d->orders = $orders;
|
||||
$d->position = $position;
|
||||
@ -58,6 +63,7 @@ if ($action == 'add') {
|
||||
}
|
||||
}
|
||||
$widget['position'] = $pos;
|
||||
$widget['user'] = $tipeUser;
|
||||
$ui->assign('users', ORM::for_table('tbl_widgets')->getEnum("user"));
|
||||
$ui->assign('do', 'add');
|
||||
$ui->assign('widgets', $widgets);
|
||||
|
@ -8,8 +8,9 @@
|
||||
{/foreach}
|
||||
{/function}
|
||||
|
||||
{assign dtipe value="dashboard_`$tipeUser`"}
|
||||
|
||||
{assign rows explode(".", $_c['dashboard_cr'])}
|
||||
{assign rows explode(".", $_c[$dtipe])}
|
||||
{assign pos 1}
|
||||
{foreach $rows as $cols}
|
||||
{if $cols == 12}
|
||||
|
@ -32,11 +32,11 @@
|
||||
</td>
|
||||
<td width="130">
|
||||
<div class="btn-group btn-group-justified" role="group">
|
||||
<a href="{Text::url('widgets/delete/', $w['id'])}"
|
||||
<a href="{Text::url('widgets/delete/', $w['id'], '&user=', $tipeUser)}"
|
||||
onclick="return ask(this, 'Delete this widget?')" class="btn btn-sm btn-danger">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
<a href="{Text::url('widgets/edit/', $w['id'])}"
|
||||
<a href="{Text::url('widgets/edit/', $w['id'], '&user=', $tipeUser)}"
|
||||
class="btn btn-sm btn-success">{Lang::T("Edit")}</a>
|
||||
</div>
|
||||
</td>
|
||||
@ -51,25 +51,25 @@
|
||||
<div class="btn-group" role="group">
|
||||
<button type="submit" class="btn btn-info">{Lang::T("Save sequence")}</button>
|
||||
</div>
|
||||
<a href="{Text::url('widgets/add/', $pos, '&user=', $tipeUser)}" class="btn btn-primary">{Lang::T("Add new widget")}</a>
|
||||
<a href="{Text::url('widgets/add/', $pos, '&user=', $tipeUser)}" class="btn btn-xs btn-primary">{Lang::T("Add new widget")}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/function}
|
||||
|
||||
{assign dtipe value="dashboard_`$tipeUser`"}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">{Lang::T("Dashboard Structure")}</div>
|
||||
<div class="panel-body">
|
||||
{assign rows explode(".", $_c['dashboard_cr'])}
|
||||
{assign rows explode(".", $_c[$dtipe])}
|
||||
{assign pos 1}
|
||||
{foreach $rows as $cols}
|
||||
{if $cols == 12}
|
||||
<div class="row row-no-gutters">
|
||||
<div class="col-xs-12" style="border: 1px;">
|
||||
<a href="{Text::url('widgets/add/', $pos)}" class="btn btn-default btn-block">{$pos}</a>
|
||||
<a href="{Text::url('widgets/add/', $pos, '&user=', $tipeUser)}" class="btn btn-default btn-block">{$pos}</a>
|
||||
</div>
|
||||
</div>
|
||||
{assign pos value=$pos+1}
|
||||
@ -78,7 +78,7 @@
|
||||
<div class="row row-no-gutters">
|
||||
{foreach $colss as $c}
|
||||
<div class="col-xs-{$c}">
|
||||
<a href="{Text::url('widgets/add/', $pos)}" class="btn btn-default btn-block">{$pos}</a>
|
||||
<a href="{Text::url('widgets/add/', $pos, '&user=', $tipeUser)}" class="btn btn-default btn-block">{$pos}</a>
|
||||
</div>
|
||||
{assign pos value=$pos+1}
|
||||
{/foreach}
|
||||
@ -91,7 +91,6 @@
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><a href="{$app_url}/docs/#Dashboard%20Structure"
|
||||
target="_blank">{Lang::T("Structure")}</a></span>
|
||||
{assign dtipe value="dashboard_`$tipeUser`"}
|
||||
<input type="text" name="dashboard" value="{$_c[$dtipe]}" class="form-control"
|
||||
placeholder="Dashboard">
|
||||
</div>
|
||||
|
@ -52,12 +52,10 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('User')}</label>
|
||||
<div class="col-md-5">
|
||||
<select name="tipeUser" id="tipeUser" class="form-control">
|
||||
{foreach $users as $u}
|
||||
<option value="{$u}" {if $tipeUser eq $u}selected="selected" {/if}>
|
||||
Dashboard {$u}
|
||||
</option>
|
||||
{/foreach}
|
||||
<select name="tipeUser" aria-readonly="" id="tipeUser" class="form-control">
|
||||
<option value="{$widget['user']}" {if $widget['user'] eq $u}selected="selected" {/if}>
|
||||
Dashboard {$widget['user']}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="help-block col-md-4"> </p>
|
||||
@ -66,10 +64,12 @@
|
||||
<label class="col-md-3 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-5">
|
||||
<select name="enabled" id="enabled" class="form-control">
|
||||
<option value="1" {if isset($widget['enabled']) && $widget['enabled'] neq 1}selected="selected" {/if}>
|
||||
<option value="1"
|
||||
{if isset($widget['enabled']) && $widget['enabled'] neq 1}selected="selected" {/if}>
|
||||
{Lang::T('Active')}
|
||||
</option>
|
||||
<option value="0" {if isset($widget['enabled']) && $widget['enabled'] eq 0}selected="selected" {/if}>
|
||||
<option value="0"
|
||||
{if isset($widget['enabled']) && $widget['enabled'] eq 0}selected="selected" {/if}>
|
||||
{Lang::T('Not Active')}
|
||||
</option>
|
||||
</select>
|
||||
@ -79,14 +79,17 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Content')}</label>
|
||||
<div class="col-md-9">
|
||||
<textarea name="content" rows="15" id="summernote" class="form-control">{$widget['content']}</textarea>
|
||||
<p class="help-block">{Lang::T("Not all widgets require content. HTML widgets require content, either text or PHP code. Please be careful when writing this content.")}</p>
|
||||
<textarea name="content" rows="15" id="summernote"
|
||||
class="form-control">{$widget['content']}</textarea>
|
||||
<p class="help-block">
|
||||
{Lang::T("Not all widgets require content. HTML widgets require content, either text or PHP code. Please be careful when writing this content.")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<div class="btn-group btn-group-justified" role="group">
|
||||
<a href="{Text::url('widgets/')}" class="btn btn-default btn-block">{Lang::T('Back')}</a>
|
||||
<a href="{Text::url('widgets/', '&user=', $tipeUser)}" class="btn btn-default btn-block">{Lang::T('Back')}</a>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="submit" class="btn btn-info btn-block">{Lang::T('Save')}</button>
|
||||
</div>
|
||||
@ -94,7 +97,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{if $do == 'edit'}
|
||||
<a href="{Text::url('widgets/delete/', $widget['id'])}" class="btn btn-danger btn-xs"
|
||||
<a href="{Text::url('widgets/delete/', $widget['id'], '&user=', $tipeUser)}" class="btn btn-danger btn-xs"
|
||||
onclick="return ask(this, 'Remove this widget?')">{Lang::T('Delete')}</a>
|
||||
{/if}
|
||||
</div>
|
||||
@ -102,7 +105,7 @@
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function changeTitle(sel){
|
||||
function changeTitle(sel) {
|
||||
var name = sel.options[sel.selectedIndex].text;
|
||||
document.getElementById('title').value = name;
|
||||
}
|
||||
@ -111,4 +114,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
{include file="sections/footer.tpl"}
|
Loading…
x
Reference in New Issue
Block a user