Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<script>
    $(function(){
        $('.switch_login').button({
            icons:
            {
                primary:"ui-icon-zoomin"
            }
        }).click(switch_login);
        $('.show_login').button({
            icons:
            {
                primary:"ui-icon-extlink"
            }
        }).click(show_login);
        $('#add_login').button({
            icons:
            {
                primary:"ui-icon-plus"
            }
        }).click(add_login);
        $('#add_login_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            height:600,
            modal:true,
            resizable:false,
            buttons:
            {
                "speichern": function()
                {
                    $.post("/logins/preisstaffel.php",$('#add_login_dialog_form').serializeArray(),function(html){
                        //alert(html);
                        a_id=$('#a_id').val();
                        s_id=$('#s_id').val();
                        $('#preise_dialog').load("/logins/preise.php?a_id="+a_id+"&s_id="+s_id)
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('.edit_login').button({
            icons:{
                primary: "ui-icon-pencil"
            }
        }).click(edit_login);
        $('#edit_login_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            modal:true,
            resizable:false,
            buttons:
            {
                "speichern": function()
                {
                    $.post("/logins/preisstaffel.php",$('#edit_preis_dialog_form').serializeArray(),function(html){
                        a_id=$('#a_id').val();
                        s_id=$('#s_id').val();
                        $('#preise_dialog').load("/logins/preise.php?a_id="+a_id+"&s_id="+s_id)
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('#del_login_dialog').dialog("destroy").dialog({
            autoOpen:false,
            width:700,
            modal:true,
            resizable:false,
            buttons:
            {
                "löschen": function()
                {
                    $.post("/logins/preisstaffel.php",$('#del_login_dialog_form').serializeArray(),function(html){
                        //alert(html);
                        //login_id=$('#login_nr').val();
                        a_id=$('#a_id').val();
                        s_id=$('#s_id').val();
                        $('#preise_dialog').load("/logins/preise.php?a_id="+a_id+"&s_id="+s_id)
                    });
                    $(this).dialog("close");
                },
                "abbrechen": function()
                {
                    $(this).dialog("close");
                }
            }
        });
        $('#search_l').button().click(suche_l);
        function switch_login()
        {
            id=this.id;
            id=id.split("_");
            l_id=id[2];
            $(document).attr("location","/logins/logins.php?action=edit&ID="+l_id);
            return false;
        }
        function show_login()
        {
            id=this.id;
            id=id.split("_");
            l_id=id[2];
            $('#preise_dialog').load("/logins/preise.php?login="+l_id);
            return false;
        }
        function suche_l()
        {
            $('#ergebnis_l').load("/logins/suche_login.php",$('#add_login_dialog_form').serializeArray());
            return false;
        }
        function add_login()
        {
            $('#preis_l').hide();
            $("#login").hide();
            $('#login_suche').show();
            $('#add_login_dialog').dialog("open");
            return false;
        }
        function edit_login()
        {
            id=this.id;
            id=id.split("_");
            id=id[2]
            $('#edit_login_dialog').load("/logins/preisstaffel.php?id="+id).dialog("open");
            return false;
        }
        $('.del_login').button({
            icons:{
                primary: "ui-icon-trash"
            }
        }).click(del_login);
        
        function del_login()
        {
            id=this.id;
            id=id.split("_");
            id=id[2];
            //alert(id);
            $('.del_id_l').val(id);
            $('#del_login_dialog').dialog("open");
            return false;
        }
    });
</script>
<button id="add_login" title="neuen Preis zuordnen"></button>
<table width="800">
    <tr>
        <th colspan="8" style="font-size:24px;">Preise für Artikel {$a_id} - {$daten.artikel.kurzbezeichnung}</th>
    </tr>
    <tr>
        <td>ID</td>
        <td>Loginnummer</td>
        <td>Name</td>
        <td>Shopnummer</td>
        <td>Shopname</td>
        <td>Shoppreis</td>
        <td>Kundenpreis</td>
        <td>Aktionen</td>
    </tr>
{foreach $daten.logins as $zeile}
    <tr>
        <td>{$zeile.id}</td>
        <td>{$zeile.login_id}</td>
        <td>{$zeile.login_name}</td>
        <td>{$zeile.shop_id}</td>
        <td>{$zeile.name}</td>
        <td>
            {if $zeile.preis1 < 0}
            {$zeile.preis1|abs}%
            {else}
            {$zeile.preis1|money_format}
            {/if}
        </td>
        <td>
            {if $zeile.preis.preis[0] < 0}
            {$zeile.preis.preis[0]|abs}%
            {else}
            {$zeile.preis.preis[0]|money_format}
            {/if}
        </td>
        <td>
            <button id="edit_preis_{$zeile.id}" class="edit_login" title="ändern"></button>
            <button id="del_preis_{$zeile.id}" class="del_login" title="löschen"></button>
            <button id="show_login_{$zeile.login_id}_{$zeile.shop_id}" class="show_login" title="alle Artikelpreise für diesen Kunden"></button>
            <button id="switch_login_{$zeile.login_id}" class="switch_login" title="zu Login {$zeile.login_id} - {$zeile.login_name} wechseln"></button>
        </td>
    </tr>
{/foreach}
</table>
<input type="hidden" id="a_id" value="{$a_id}" />
<input type="hidden" id="s_id" value="{$s_id}" />

<div id="edit_login_dialog" title="Preise bearbeiten">
</div>

<div id="add_login_dialog" title="Artikelpreis zuordnen">
    <form id="add_login_dialog_form">
        <table>
            <tr id="login">
                <td valign="top">Kunde</td>
                <td>
                    <span id="login_name"></span>
                    <input type="hidden" name="login_id" id="login_nr" />
                </td>
            </tr>
            <tr id="login_suche">
                <td valign="top">Kundensuche</td>
                <td>
                    <input type="text" name="suche" id="suche_l" />
                    <button id="search_l">suche</button>
                    <div id="ergebnis_l">
                    </div>
                </td>
            </tr>
            <tr id="preis_l">
                <td>Preis</td>
                <td>
                    <input type="text" name="staffel[1][preis][0]" value="" />
                    <input type="hidden" name="mode" value="save" />
                    <input type="hidden" name="artikel_id" value="{$a_id}" />
                    <input type="hidden" name="shop_id" value="{$s_id}" />
                </td>
            </tr>
        </table>
    </form>
</div>

<div id="del_login_dialog" title="Preise löschen">
    <form id="del_login_dialog_form">
        <table>
            <tr>
                <td>Wollen Sie diese Zuordnung wirklich löschen</td>
                <td>
                    <input type="hidden" name="id" class="del_id_l" value="" />
                    <input type="hidden" name="mode" value="delete" />
                </td>
            </tr>
        </table>
    </form>
</div>