summaryrefslogtreecommitdiff
path: root/views/mods/mod_kundenverwaltung/index.phtml
blob: 3b35ecbd4b50c5ec6c79bc024b6ffe50b418780e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<?php 

	/**
	 * Template für die Kundenübersichtsseite im Backend
	 */

?>
<div class="wpsg_customer" id="wpsg-bs">

    <nav class="navbar navbar-default">

		<div class="container-fluid">
			<div class="navbar-header">
				<a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
			</div>
			<div class="collapse navbar-collapse" id="bs-customer-navbar-collapse-1">
				<ul class="nav navbar-nav">
					<li role="presentation" class="<?php echo ((!isset($_REQUEST['action']))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer" onclick="return false;"><?php echo wpsg_translate(__("Kundenverwaltung (#1# Kunden)", "wpsg"), $this->view['countAll']); ?></a></li>
					<li role="presentation" class="wpsg-customer-tab-a wpsg_showhide_filter <?php echo ((wpsg_isTrue($this->view['hasFilter']))?'active':''); ?>" id="wpsg-customer-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php 
						
						echo wpsg_admin_url('Customer', 'add'); 
						
					?>"><span class="glyphicon glyphicon-plus"></span><?php echo __("Hinzufügen", "wpsg"); 
							
					?></a></li>
                    
                    <?php /* Integration Exportprofile */ ?>
                    <?php if ($this->hasMod('wpsg_mod_export')) { $arProfile = $this->callMod('wpsg_mod_export', 'getProfile', array(wpsg_mod_export::TYPE_CUSTOMER)); ?>
                    <?php if (wpsg_isSizedArray($arProfile)) { ?>
                    <li role="presentation" class="wpsg_showhide_export"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-export"></span><?php echo __('Kundenexport (Exportprofile)', 'wpsg'); ?></a></li>
                    <?php } ?>
                    <?php } ?>
                        
				</ul>
				<ul class="nav navbar-nav navbar-right">
                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php
		
						echo wpsg_admin_url('Customer', 'import', [], ['noheader' => '1']);
							
					?>"><span class="glyphicon glyphicon-import"></span><?php echo __("Daten-Import", "wpsg"); ?></a></li>
					<?php if (wpsg_isSizedArray($this->view['arData'])) { ?>
					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php
							
						echo wpsg_admin_url('Customer', 'export', [], ['noheader' => '1']);

					?>"><span class="glyphicon glyphicon-export"></span><?php echo __("Daten-Export", "wpsg"); ?></a></li>
					<?php } ?>
				</ul>
			</div>
		</div>

        <div class="wpsg-filter wpsg-customer-tab wpsg-customer-tab-0 container-fluid form-horizontal" style="display:<?php echo ((wpsg_isTrue($this->view['hasFilter']))?'block':'none'); ?>;">
            <div class="row">
				<div class="col-lg-4">
					<form method="post" id="filter_form">

						<?php echo wpsg_formNounce('Customer', 'search'); ?>
						
						<input id="wpsg_seite" type="hidden" name="filter[page]" value="<?php echo @$this->view['arFilter']['page']; ?>" class="current-page" />

                        <input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo @$this->view['arFilter']['order']; ?>" />
						<input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo @$this->view['arFilter']['ascdesc']; ?>" />

						<?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($this->view['arFilter']['s'])); ?>
                        
                        <?php if ($this->hasMod('wpsg_mod_customergroup')) { ?>
                        
                            <?php echo wpsg_drawForm_Select('filter[group_id]', __('Kundengruppe', 'wpsg'), wpsg_array_merge([0 => __('Alle Kundengruppen', 'wpsg')], $this->callMod('wpsg_mod_customergroup', 'getCustomerGroupArray')), wpsg_getStr($this->view['arFilter']['group_id'])); ?>
                            
                        <?php } ?>

						<?php echo wpsg_drawForm_SubmitButton(__('Kunden suchen')); ?><br />

					</form>
				</div>
			</div>
        </div>

        <?php /* Integration Exportprofile */ ?>
        <?php if ($this->hasMod('wpsg_mod_export')) { $arProfile = $this->callMod('wpsg_mod_export', 'getProfile', array(wpsg_mod_export::TYPE_CUSTOMER)); ?>
        <?php if (wpsg_isSizedArray($arProfile)) { ?>
        <div class="wpsg-export container-fluid form-horizontal" style="display:none;">
            
            <form class="container-fluid form-horizontal" target="_blank" method="post" action="<?php echo WPSG_URL_WP ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=handleExport&noheader=1" onsubmit="wpsg_mod_export_serializefilter();">
        
                <div class="row">
                    <div class="col-lg-4">
            
                        <?php foreach ($arProfile as $p) { ?>
                            <?php echo wpsg_drawForm_Checkbox('wpsg_mod_export_profile[]', $p['name'], false, array('value' => $p['id'], 'noHidden' => true)); ?>
                        <?php } ?>
            
                        <br /><?php echo wpsg_drawForm_SubmitButton(__('Export starten')); ?>
            
                    </div>
                </div>
            
                <input type="hidden" name="filter" id="wpsg_mod_export_filter" value="" />
            
            </form>
       
            <script type="text/javascript">/* <![CDATA[ */
                   
                function wpsg_mod_export_serializefilter()
                {
            
                    jQuery('#wpsg_mod_export_filter').val(jQuery('#filter_form').serialize());
            
                }
                
                jQuery(document).ready(function() {
                    
                    jQuery('.wpsg_showhide_export').off('click').on('click', function() {
                        
                        jQuery(this).toggleClass('active');
                        jQuery('.wpsg-export').toggle(250);
                        
                        return false;
                        
                    } );
                    
                } );
            
            /* ]]> */</script>
            
        </div>       
        <?php } ?>
        <?php } ?>
        
    </nav>

    <div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"></div>

	<div class="wpsg_clear"></div>
	
    <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>

	<div class="wpsg_clear"></div>

    <form method="POST">
        <div class="content">
    
            <?php if (is_array($this->view['arData']) && sizeof($this->view['arData']) > 0) { ?>
    
                <table class="table wpsg-table-order table-bordered table-hover table-striped wpsg-table-customer">
                    <thead>
                        <tr>
                            <th class="manage-column column-title wpsg_pic_col wpsg_order col_id" data-order="id">
																
								<input style="margin-right:30px;" type="checkbox" value="1" id="wpsg_check_all" onclick="return wpsg_customer_checkAll();" name="" />
								
                            </th>
                            <th class="wpsg_order col_name" data-order="nr"><?php echo __("Nr/Name", 'wpsg'); ?></th>
                            <th class="wpsg_order col_adress" data-order="adress"><?php echo __("Anschrift", 'wpsg'); ?></th>
                            <th class="wpsg_order col_status" data-order="status"><?php echo __("Status", 'wpsg'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($this->view['arData'] as $c) { ?>
	                        <?php if(wpsg_isSizedInt($_REQUEST['customergroup']) && $_REQUEST['customergroup'] !== $c->group_id) continue; ?>
                        <tr>
                            <td class="wpsg_pic_col">
    
                                <img src="https://www.gravatar.com/avatar/<?php echo md5(strtolower(trim($c->getEMail()))); ?>?s=40&d=mm" alt=""" />
    
                                <input class="col_set_checkbox" type="checkbox" value="<?php echo $c->id; ?>" name="customer[]" />
                                
                            </td>
                            <td class="col_name column-title">
                                <strong><a title="<?php echo __("Diesen Kunden bearbeiten", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=edit&edit_id=<?php echo $c->id; ?>" class="row-title"><?php echo trim($c->GetNr().' '.$c->getLabel()); ?></a></strong>
                                <?php if (strlen($c->getEMail()) > 0) { ?>
                                    <a href="mailto:<?php echo $c->getEMail(); ?>" title="<?php echo __('Dem Kunden eine E-Mail schreiben.', 'wpsg'); ?>"><?php echo $c->getEMail();  ?></a>
                                <?php } ?>
                                <div class="row-actions">
                                    <span class="edit"><a title="<?php echo __("Diesen Kunden bearbeiten", "wpsg"); ?>" href="<?php 
											
										echo wpsg_admin_url('Customer', 'edit', ['edit_id' => $c->getId()]);
											
									?>"><?php echo __("Bearbeiten", "wpsg"); ?></a></span>
                                    |
                                    <span class="del"><a onclick="if (!confirm('<?php echo __("Sind Sie sicher, dass Sie den Kunden löschen wollen?", "wpsg"); ?>')) return false;" title="<?php echo __("Diesen Kunden löschen", "wpsg"); ?>" href="<?php 
									
										echo wpsg_admin_url('Customer', 'del', ['edit_id' => $c->id]);		
											
									?>&noheader=1"><?php echo __("Löschen", "wpsg"); ?></a></span>
                                    |
									
                                    <?php if ($c->status !== '-1') { ?>
                                    |
                                    <span class="order"><a href="<?php 
											
										echo wpsg_admin_url('Admin', 'module', ['modul' => 'wpsg_mod_kundenverwaltung', 'be_ajax' => 'su_index', 'k_id' => $c->getId()], ['noheader' => '1']);											
											
									?>"><?php echo __('Kundenlogin simulieren', 'wpsg'); ?></a></span>
                                    <?php } ?>
                                    
                                </div>
                            </td>
                            <td class="col_adress">
                                <?php echo ((strlen($c->getCompany()) > 0)?$c->getCompany().'<br />':''); ?>
                                <?php echo $c->getStreet(); ?><br />
                                <?php echo trim($c->getZip().' '.$c->getCity()); ?>
                                <?php /*echo $c->plz.' '.$c->ort.' '.$c->land_kuerzel; */?><br />
                            </td>
                            <td class="col_status">
                                <?php echo wpsg_translate(__('#1# Bestellungen', 'wpsg'), $c->getOrderCount()); ?><br />
                                <?php echo wpsg_translate(__('Umsatz: #1#', 'wpsg'), wpsg_ff($c->getOrderAmount(), $this->get_option('wpsg_currency'))); ?>
                                <?php if ($c->getOrderCount() > 0) { ?>
                                <br />
                                <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&filter[k_id]=<?php echo $c->id; ?>"><?php echo __('Bestellungen einsehen', 'wpsg'); ?></a>
                                <?php } ?>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
    
                <div class="tablenav bottom">
                    <div class="alignleft actions">
                        <select name="wpsg_do" id="wpsg_do">
                            <option value="-1"><?php echo __('Aktion wählen', 'wpsg'); ?></option>
                            <option value="setAccount"><?php echo __('Kundenkonto zuordnen', 'wpsg'); ?></option> 
                        </select>
                        <input type="submit" class="button-secondary" id="doaction" value="<?php echo __('Ausführen', 'wpsg'); ?>" name="wpsg_doaction" />
                    </div>
                </div>
    
                <div style="margin-right:-15px;">
                    <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
                </div>
    
            <?php } else { ?>
    
                <?php echo wpsg_drawForm_AdminboxStart(); ?>
                <?php echo __('Keine Kunden in der Datenbank.', 'wpsg'); ?>
                <?php echo wpsg_drawForm_AdminboxEnd(); ?>
    
            <?php } ?>
    
        </div>
    </form>

</div>

<script type="text/javascript">/* <![CDATA[ */

    <?php if (wpsg_isSizedString($this->view['arFilter']['order']) && wpsg_isSizedString($this->view['arFilter']['ascdesc'])) { ?>
    jQuery('th[data-order="<?php echo $this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['arFilter']['ascdesc']); ?>');
    <?php } ?>

    function wpsg_customer_checkAll()
    {

        jQuery('.col_set_checkbox').each(function() { jQuery(this).prop('checked', !jQuery(this).prop('checked')); } );

    }

    function goPage(page)
	{

		//if (page <= 0 || page == <?php echo $this->view['arFilter']['page']; ?> || page > <?php echo $this->view['pages']; ?>) return;

		jQuery('#wpsg_seite').val(page);
		jQuery('#filter_form').submit();

		return false;

	} // function goPage(page)

/* ]]> */</script>